Commit Graph

10908 Commits

Author SHA1 Message Date
Fabian Homborg
e0d623d4b7 tests/test_util: Fix wrong argument in delta
This spewed errors because the `math` invocation got no second
operand:

    Testing file checks/sigint.fish ... math: Error: Too few arguments
    '1571487730 -'

but only if the `date` didn't do milliseconds, which is the case on
FreeBSD and NetBSD.

(also force the variable to be global - we don't want to have a
universal causing trouble here)
2019-10-19 14:27:47 +02:00
Fabian Homborg
fc0c39b6fd expand: Remove unused includes
sys/sysctl.h is deprecated on glibc, so it leads to warnings.
According to fa4ec55c96, it was included for KERN_PROCARGS2 for
process expansion, but process expansion is gone, so it's unused now.

(there is another use of it in common.cpp, but that's only on FreeBSD)

Also 1f06e5f0b9 only included
tokenizer.h (present since the initial commit) if KERN_PROCARGS2
wasn't available, so it can't have been important.

This builds and passes the tests on:

- Archlinux, with glibc 2.30
- Alpine, with musl
- FreeBSD
- NetBSD
2019-10-19 14:20:53 +02:00
艾雨寒 ArielAxionL
9ea8aa072f add a completion for zstd support
An update has been released by Arch Linux official to support the packages for zstd compression.

> https://www.archlinux.org/news/required-update-to-recent-libarchive/
2019-10-19 12:55:30 +02:00
Johannes Altmanninger
b7f35f949e Do not import vars that are equivalent to a universal exported var
Universal exported variables (created by `set -xU`) used to show up
both as universal and global variable in child instances of fish.

As a result, when changing an exported universal variable, the
new value would only be visible after a new login (or deleting the
variable from global scope in each fish instance).

Additionally, something like `set -xU EDITOR vim -g` would be imported
into the global scope as a single word resulting in failures to
execute $EDITOR in fish.

We cannot simply give precedence to universal variables, because
another process might have exported the same variable.  Instead, we
only skip importing a variable when it is equivalent to an exported
universal variable with the same name.  We compare their values after
joining with spaces, hence skipping those imports does not change the
environment fish passes to its children. Only the representation in
fish is changed from `"vim -g"` to `vim -g`.

Closes #5258.
This eliminates the issue #5348 for universal variables.
2019-10-19 12:41:57 +02:00
Johannes Altmanninger
5e274066e3 Always return absolute path in path_get_cdpath
Fixes #6220
2019-10-19 12:38:17 +02:00
Johannes Altmanninger
868eba5e80 Fix error on typing Alt-l on a token that starts with a dash 2019-10-19 12:31:09 +02:00
ridiculousfish
c8332bae8c sucess -> success, failiure -> failure 2019-10-18 18:36:03 -07:00
ridiculousfish
9652b3e11b Clean up job_or_process_extent
This had a bad merge which happened to work, plus some other nonsense.
2019-10-18 15:24:28 -07:00
Johannes Altmanninger
2fed311d4c builtin commandline: fix flags -p and -j not splitting on && and ||
Fixes #6214
2019-10-18 09:36:52 +02:00
Johannes Altmanninger
ed8b0c8c0c Add completions for the kakoune editor
[ci skip]
2019-10-17 21:50:27 +02:00
Delapouite
a2672dea7a doc: fix links pointing to history-search section
[ci skip]
2019-10-17 21:45:36 +02:00
Fabian Homborg
9c4edb68ff Add g++ completions that wrap gcc
Should be alright for a first pass.

Fixes #6217.

[ci skip]
2019-10-17 17:45:47 +02:00
Mahmoud Al-Qudsi
b29fd88cad [rustup] Add completions for rustup show and rustup profile
[ci skip]
2019-10-16 19:05:53 -05:00
Mahmoud Al-Qudsi
9a99836c74 [rustup] Fix string replace coalesce of multiple $argv
[ci skip]
2019-10-16 18:57:03 -05:00
ridiculousfish
3c727173c2 Include ctime in history_file.h
Fixes a build failure on FreeBSD.

Fixes #6210
2019-10-16 11:55:40 -07:00
Johannes Altmanninger
a6f5d9c0eb
Merge pull request #6103 from krobelus/expand-arg-to-short-option
Completion: complete argument to last of a group of short options
2019-10-16 11:37:04 +02:00
Johannes Altmanninger
eae1683033 Completion: complete argument to last of a group of short options
Consider a group of short options, like -xzPARAM, where x and z are options and z takes an argument.

This commit enables completion of the argument to the last option (z), both within the same
token (-xzP) or in the next one (-xz P).

complete -C'-xz' will complete only parameters to z.
complete -C'-xz ' will complete only parameters to z if z requires a parameter
otherwise, it will also complete non-option parameters

To do so this implements a heuristic to differentiate such strings from single long options. To
detect whether our token contains some short options, we only require the first character after the
dash (here x) to be an option. Previously, all characters had to be short options. The last option
in our example is z. Everything after the last option is assumed to be a parameter to the last
option.

Assume there is also a single long option -x-foo, then complete -C'-x' will suggest both -x-foo and
-xy. However, when the single option x requires an argument, this will not suggest -x-foo.
However, I assume this will almost never happen in practise since completions very rarely mix
short and single long options.

Fixes #332
2019-10-16 11:30:50 +02:00
Johannes Altmanninger
41bcf77e25 fix comment 2019-10-16 11:25:11 +02:00
Johannes Altmanninger
203a2e7af4 completions/grep: specify some required parameters 2019-10-16 11:23:53 +02:00
Johannes Altmanninger
466b6e1b43
Merge pull request #6207 from krobelus/sphinx-toc
sphinx: highlight current page in the site navigation
2019-10-16 11:19:27 +02:00
Johannes Altmanninger
c64aec9019
Merge pull request #6211 from Delapouite/doc-dirs
doc: add links between dirs, pushd and popd
2019-10-16 11:19:10 +02:00
Delapouite
e3caaed73f doc: add links between dirs, pushd and popd
[ci skip]
2019-10-16 09:05:59 +02:00
ARifleman
876176fc94 Added 'Nord' color scheme to sample color schemes (#6201) 2019-10-15 23:18:18 -07:00
ridiculousfish
ca11b5edc8 Add a simple test for SIGINT out of loops 2019-10-15 22:33:53 -07:00
ridiculousfish
cc1c973025 Remove job_flags as an enum, just use a struct
This removes an over-complicated flag implementation, replacing it with
just a plain struct.
2019-10-15 14:40:58 -07:00
Johannes Altmanninger
cff721afda sphinx: highlight current page in the site navigation
Fixes #6189
2019-10-15 22:25:23 +02:00
Z. Grace Moreau
4c63ae357a update CHANGELOG 2019-10-15 13:05:08 -07:00
Z. Grace Moreau
ff2baf2591 add completions for Visual Studio Code CLI tool 2019-10-15 13:05:08 -07:00
Bruno Heridet
38eb7129d3 doc: add links to bg, fg and jobs in disown command
[ci skip]
2019-10-15 12:57:01 -07:00
ridiculousfish
35671dd9f0 Clean up and unify pipes and redirections
This cleans up how pipes and redirections are recognized by the parser,
and unifies pipes and redirections into a single type.
2019-10-15 11:26:41 -07:00
Johannes Altmanninger
2d2e15b63d Silently ignore recursive calls to complete -C without parameter
In e167714899 we allowed recursive calls
to complete. However, some completions use infinite recursion in their
completions and rely on `complete` to silently stop as soon as it is
called recursively twice without parameter (thus completing the
current commandline). For example:

complete -c su -s -xa "(complete -C(commandline -ct))"
su -c <TAB>

Infinite recursion happens because (commandline -ct) is an empty list,
which would print an error message.  This commmit explicitly detects
such recursive calls where `complete` has no parameter and silently
terminates.  This enables above completion (like before raising the
recursion limit) while still allowing legitimate cases with limited
recursion.

Closes #6171
2019-10-15 13:36:28 +02:00
Johannes Altmanninger
cf3b24cf62 fix typo 2019-10-15 13:30:21 +02:00
Mark Stosberg
087500e7b9 doc: document relative path support for source.
[ci skip]
2019-10-14 18:58:30 +02:00
Aaron Gyes
d1970c7f2e read_ni: be more specific in error if a file can't be read
for example, `fish /etc` now tells us "Is a directory"

make a couple char constants wchar_t constants
2019-10-14 01:43:35 -07:00
Aaron Gyes
5d84d3fe48 reader.cpp: remove unused pointer in read_ni
literally prehistoric in git blame
2019-10-14 00:42:03 -07:00
ridiculousfish
4b6de8b4a3 Clean up a stale comment. 2019-10-13 23:05:55 -07:00
ridiculousfish
c160492d42 Remove tok_t::redirected_fd
This wasn't used for anything.
2019-10-13 23:04:18 -07:00
ridiculousfish
1a65e18ba8 Clean up some tokenization
Remove TOK_NONE
Turn token_type into an enum class
Make next() turn a maybe_t<tok_t> instead of a bool
2019-10-13 16:06:16 -07:00
ridiculousfish
82eca4bc86 Run clang-format on all files
The main change here is to reorder headers.
2019-10-13 15:50:48 -07:00
ridiculousfish
e73e9c3e2e Ensure that clang-format places config.h first in header list 2019-10-13 15:45:02 -07:00
Andy
39671e6b19 Fix ranger options: choosefile(s), choosedir
Source <ee344c896e/ranger/core/main.py (L293-L303)>
2019-10-13 12:14:08 -07:00
Sergei Morozov
478f54c035 Added PHPUnit shell completion 2019-10-13 12:13:34 -07:00
Per Bothner
d502ad2c25 Prefer using clr_eos to clear "remaining lines"
This is both more efficient than multiple clr_eol sequences,
and also works better with shell-integration.
2019-10-13 12:12:44 -07:00
Delapouite
09a97528a9 doc: add cross-refs between if and else commands 2019-10-10 18:17:10 +02:00
Clément Martinez
1f35b146de Add grub-mkrescue completions 2019-10-10 18:16:32 +02:00
aca
8c5aca599f completions/fzf: completion for fzf 2019-10-10 18:16:00 +02:00
Aaron Miller
15ed682bfa Fix options after --argument-names to function (#6188)
This stops reading argument names after another option appears. It does not break any previous uses and in fact fixes uses like

```fish
function foo --argument-names bar --description baz
```

* `function` command handles options after argument names (Fixes #6186)

* Removed unneccesary test
2019-10-10 18:09:26 +02:00
jalr
3d1e9423c2 cd: Add test for changing to a dir starting with a - char 2019-10-10 18:06:11 +02:00
jalr
2e6ab0b418 cd: Fix test for too many args 2019-10-10 18:06:11 +02:00
Greg Anders
055a332133 Only print extra newlines for multi-line prompts (#6179)
Corrects #6110

BSD `seq` produces a down-counting sequence when the second argument is
smaller than the first, e.g.:

    $ seq 2 1
    2
    1
    $

While GNU `seq` produces no output at all:

    $ seq 2 1
    $

To accommodate for this behavior, only run `seq` when we are sure that
the second argument is greater than or equal to the first (in this case,
the second argument `line_count` should be greater than 1).
2019-10-08 19:14:51 +02:00