diff --git a/share/completions/cabal.fish b/share/completions/cabal.fish index 4075b39e2..b5e4ac1fc 100644 --- a/share/completions/cabal.fish +++ b/share/completions/cabal.fish @@ -1,11 +1,9 @@ function __fish_complete_cabal - if type -q -f cabal - set -l cmd (commandline -poc) - if test (count $cmd) -gt 1 - cabal $cmd[2..-1] --list-options - else - cabal --list-options - end + set -l cmd (commandline -poc) + if test (count $cmd) -gt 1 + cabal $cmd[2..-1] --list-options + else + cabal --list-options end end diff --git a/share/completions/pip.fish b/share/completions/pip.fish index 6280623cb..4007379b8 100644 --- a/share/completions/pip.fish +++ b/share/completions/pip.fish @@ -1,4 +1 @@ -if command -sq pip - pip completion --fish 2>/dev/null | source -end - +pip completion --fish 2>/dev/null | source diff --git a/share/completions/pip2.fish b/share/completions/pip2.fish index c798fbb65..11f834d04 100644 --- a/share/completions/pip2.fish +++ b/share/completions/pip2.fish @@ -1,7 +1,5 @@ -if command -sq pip2 - # pip[2|3] emits (or emitted) completions with the wrong command name - # See discussion at https://github.com/fish-shell/fish-shell/pull/4448 - # and pip bug at https://github.com/pypa/pip/pull/4755 - # Keep this even after pip fix is upstreamed for users not on the latest pip - pip2 completion --fish 2>/dev/null | string replace -r -- " -c\s+pip\b" " -c pip2" | source -end +# pip[2|3] emits (or emitted) completions with the wrong command name +# See discussion at https://github.com/fish-shell/fish-shell/pull/4448 +# and pip bug at https://github.com/pypa/pip/pull/4755 +# Keep this even after pip fix is upstreamed for users not on the latest pip +pip2 completion --fish 2>/dev/null | string replace -r -- " -c\s+pip\b" " -c pip2" | source diff --git a/share/completions/pip3.fish b/share/completions/pip3.fish index 11c8dd12d..b42fc5491 100644 --- a/share/completions/pip3.fish +++ b/share/completions/pip3.fish @@ -1,7 +1,5 @@ -if command -sq pip3 - # pip[2|3] emits (or emitted) completions with the wrong command name - # See discussion at https://github.com/fish-shell/fish-shell/pull/4448 - # and pip bug at https://github.com/pypa/pip/pull/4755 - # Keep this even after pip fix is upstreamed for users not on the latest pip - pip3 completion --fish 2>/dev/null | string replace -r -- " -c\s+pip\b" " -c pip3" | source -end +# pip[2|3] emits (or emitted) completions with the wrong command name +# See discussion at https://github.com/fish-shell/fish-shell/pull/4448 +# and pip bug at https://github.com/pypa/pip/pull/4755 +# Keep this even after pip fix is upstreamed for users not on the latest pip +pip3 completion --fish 2>/dev/null | string replace -r -- " -c\s+pip\b" " -c pip3" | source diff --git a/share/completions/sysctl.fish b/share/completions/sysctl.fish index d5cca7390..031b9e437 100644 --- a/share/completions/sysctl.fish +++ b/share/completions/sysctl.fish @@ -1,46 +1,43 @@ -if type -q -f sysctl - # Only GNU and BSD sysctl seem to know "-h", so others should exit non-zero - if sysctl -h >/dev/null 2>/dev/null - # Print sysctl keys and values, separated by a tab - function __fish_sysctl_values - sysctl -a 2>/dev/null | string replace -a " = " \t - end - - complete -c sysctl -a '(__fish_sysctl_values)' -f - - complete -c sysctl -s w -d 'parameter to use.' - complete -c sysctl -s n -l values -d 'Only print values' - complete -c sysctl -s e -l ignore -d 'Ignore errors about unknown keys' - complete -c sysctl -s N -l names -d 'Only print names' - complete -c sysctl -s q -l quiet -d 'Be quiet when setting values' - complete -c sysctl -l write -d 'Write value' - complete -c sysctl -o 'p[FILE]' -l 'load[' -d 'Load in sysctl settings from the file specified or /etc/sysctl' - complete -c sysctl -s a -l all -d 'Display all values currently available' - complete -c sysctl -l deprecated -d 'Include deprecated parameters too' - complete -c sysctl -s b -l binary -d 'Print value without new line' - complete -c sysctl -l system -d 'Load settings from all system configuration files' - complete -c sysctl -s r -l pattern -d 'Only apply settings that match pattern' - # Don't include these as they don't do anything - # complete -c sysctl -s A -d 'Alias of -a' - # complete -c sysctl -s d -d 'Alias of -h' - # complete -c sysctl -s f -d 'Alias of -p' - # complete -c sysctl -s X -d 'Alias of -a' - # complete -c sysctl -s o -d 'Does nothing, exists for BSD compatibility' - # complete -c sysctl -s x -d 'Does nothing, exists for BSD compatibility' - complete -c sysctl -s h -l help -d 'Display help text and exit.' - complete -c sysctl -s V -l version -d 'Display version information and exit.' - else - # OSX sysctl - function __fish_sysctl_values - sysctl -a 2>/dev/null | string replace -a ":" \t - end - - complete -c sysctl -a '(__fish_sysctl_values)' -f - complete -c sysctl -s a -d 'Display all non-opaque values currently available' - complete -c sysctl -s A -d 'Display all MIB variables' - complete -c sysctl -s b -d 'Output values in a binary format' - complete -c sysctl -s n -d 'Show only values, not names' - complete -c sysctl -s w -d 'Set values' - complete -c sysctl -s X -d 'Like -A, but prints a hex dump' +# Only GNU and BSD sysctl seem to know "-h", so others should exit non-zero +if sysctl -h >/dev/null 2>/dev/null + # Print sysctl keys and values, separated by a tab + function __fish_sysctl_values + sysctl -a 2>/dev/null | string replace -a " = " \t end + + complete -c sysctl -a '(__fish_sysctl_values)' -f + + complete -c sysctl -s n -l values -d 'Only print values' + complete -c sysctl -s e -l ignore -d 'Ignore errors about unknown keys' + complete -c sysctl -s N -l names -d 'Only print names' + complete -c sysctl -s q -l quiet -d 'Be quiet when setting values' + complete -c sysctl -s w -l write -d 'Write value' + complete -c sysctl -o 'p[FILE]' -l 'load[' -d 'Load in sysctl settings from the file specified or /etc/sysctl' + complete -c sysctl -s a -l all -d 'Display all values currently available' + complete -c sysctl -l deprecated -d 'Include deprecated parameters too' + complete -c sysctl -s b -l binary -d 'Print value without new line' + complete -c sysctl -l system -d 'Load settings from all system configuration files' + complete -c sysctl -s r -l pattern -d 'Only apply settings that match pattern' + # Don't include these as they don't do anything + # complete -c sysctl -s A -d 'Alias of -a' + # complete -c sysctl -s d -d 'Alias of -h' + # complete -c sysctl -s f -d 'Alias of -p' + # complete -c sysctl -s X -d 'Alias of -a' + # complete -c sysctl -s o -d 'Does nothing, exists for BSD compatibility' + # complete -c sysctl -s x -d 'Does nothing, exists for BSD compatibility' + complete -c sysctl -s h -l help -d 'Display help text and exit.' + complete -c sysctl -s V -l version -d 'Display version information and exit.' +else + # OSX sysctl + function __fish_sysctl_values + sysctl -a 2>/dev/null | string replace -a ":" \t + end + + complete -c sysctl -a '(__fish_sysctl_values)' -f + complete -c sysctl -s a -d 'Display all non-opaque values currently available' + complete -c sysctl -s A -d 'Display all MIB variables' + complete -c sysctl -s b -d 'Output values in a binary format' + complete -c sysctl -s n -d 'Show only values, not names' + complete -c sysctl -s w -d 'Set values' + complete -c sysctl -s X -d 'Like -A, but prints a hex dump' end diff --git a/share/completions/valgrind.fish b/share/completions/valgrind.fish index 67910c0e7..9ab7fed5d 100644 --- a/share/completions/valgrind.fish +++ b/share/completions/valgrind.fish @@ -1,7 +1,7 @@ # Don't go invoking valgrind unless it is installed set -l skin tool -if type -q valgrind; and valgrind --version 2>/dev/null | string match -qr -- '-2\.[012]\.' +if valgrind --version 2>/dev/null | string match -qr -- '-2\.[012]\.' # In older versions of Valgrind, the skin selection option was # '--skin' # But someone decided that it would be fun to change this to diff --git a/share/completions/vi.fish b/share/completions/vi.fish index 8042b11c0..5e12e83c7 100644 --- a/share/completions/vi.fish +++ b/share/completions/vi.fish @@ -3,23 +3,20 @@ # -wn : Set the default window size to n # +command : same as -c command -# Check if vi exists at all ( needed for vi --version ) -if type -q vi - # Check if vi is really vim - if vi --version >/dev/null 2>/dev/null - complete -c vi -w vim - else - complete -c vi -s s -d 'Suppress all interactive user feedback' - complete -c vi -s C -d 'Encrypt/decrypt text' - complete -c vi -s l -d 'Set up for editing LISP programs' - complete -c vi -s L -d 'List saved file names after crash' - complete -c vi -s R -d 'Read-only mode' - complete -c vi -s S -d 'Use linear search for tags if tag file not sorted' - complete -c vi -s v -d 'Start in display editing state' - complete -c vi -s V -d 'Verbose mode' - complete -c vi -s x -d 'Encrypt/decrypt text' - complete -c vi -r -s r -d 'Recover file after crash' - complete -c vi -r -s t -d 'Edit the file containing a tag' - complete -c vi -r -c t -d 'Begin editing by executing the specified editor command' - end +# Check if vi is really vim +if vi --version >/dev/null 2>/dev/null + complete -c vi -w vim +else + complete -c vi -s s -d 'Suppress all interactive user feedback' + complete -c vi -s C -d 'Encrypt/decrypt text' + complete -c vi -s l -d 'Set up for editing LISP programs' + complete -c vi -s L -d 'List saved file names after crash' + complete -c vi -s R -d 'Read-only mode' + complete -c vi -s S -d 'Use linear search for tags if tag file not sorted' + complete -c vi -s v -d 'Start in display editing state' + complete -c vi -s V -d 'Verbose mode' + complete -c vi -s x -d 'Encrypt/decrypt text' + complete -c vi -r -s r -d 'Recover file after crash' + complete -c vi -r -s t -d 'Edit the file containing a tag' + complete -c vi -r -c t -d 'Begin editing by executing the specified editor command' end