diff --git a/share/completions/npm.fish b/share/completions/npm.fish index 183f238a7..d531dd1d3 100644 --- a/share/completions/npm.fish +++ b/share/completions/npm.fish @@ -44,7 +44,7 @@ function __fish_complete_npm --description "Complete the commandline using npm's # with weird output on stdout (!). But before the function is called, no npm command is defined, # so calling the command would fail. # So we'll only try if we have an npm command. - if command -s npm >/dev/null + if command -sq npm # npm completion is bash-centric, so we need to translate fish's "commandline" stuff to bash's $COMP_* stuff # COMP_LINE is an array with the words in the commandline set -lx COMP_LINE (commandline -o) @@ -72,7 +72,7 @@ complete -f -c npm -n 'not __fish_npm_needs_option' -a "(__fish_complete_npm)" # list available npm scripts and their parial content function __fish_npm_run # Like above, only try to call npm if there's a command by that name to facilitate aliases that call nvm. - if command -s npm >/dev/null + if command -sq npm command npm run | string match -r -v '^[^ ]|^$' | string trim | while read -l name set -l trim 20 read -l value diff --git a/share/completions/rbenv.fish b/share/completions/rbenv.fish index cc6ef80cf..bfec90c41 100644 --- a/share/completions/rbenv.fish +++ b/share/completions/rbenv.fish @@ -28,7 +28,7 @@ function __fish_rbenv_installed_rubies end function __fish_rbenv_official_rubies - if command -s ruby-build >/dev/null + if command -sq ruby-build ruby-build --definitions else # Remove trailing spaces, otherwise completion options appear like diff --git a/share/config.fish b/share/config.fish index cb153bbe3..b63fe6bd3 100644 --- a/share/config.fish +++ b/share/config.fish @@ -268,7 +268,7 @@ if status --is-login if test "$TERM" = linux if string match -qir '\.UTF' -- $LANG - if command -s unicode_start >/dev/null + if command -sq unicode_start unicode_start end end diff --git a/share/functions/_.fish b/share/functions/_.fish index 27b03db90..3c58a73bc 100644 --- a/share/functions/_.fish +++ b/share/functions/_.fish @@ -1,7 +1,7 @@ # # Alias for gettext or a fallback if gettext isn't installed. # -if command -s gettext >/dev/null +if command -sq gettext function _ --description "Alias for the gettext command" command gettext fish $argv end diff --git a/share/functions/__fish_complete_groups.fish b/share/functions/__fish_complete_groups.fish index a7a41f0aa..051f66663 100644 --- a/share/functions/__fish_complete_groups.fish +++ b/share/functions/__fish_complete_groups.fish @@ -1,6 +1,6 @@ function __fish_complete_groups --description "Print a list of local groups, with group members as the description" - if command -s getent >/dev/null + if command -sq getent getent group | cut -d ':' -f 1,4 | sed 's/:/\t/' else cut -d ':' -f 1,4 /etc/group | sed 's/:/\t/' diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish index 0a98f4fd8..493e99651 100644 --- a/share/functions/__fish_git_prompt.fish +++ b/share/functions/__fish_git_prompt.fish @@ -330,7 +330,7 @@ end function __fish_git_prompt --description "Prompt function for Git" # If git isn't installed, there's nothing we can do # Return 1 so the calling prompt can deal with it - if not command -s git >/dev/null + if not command -sq git return 1 end set -l repo_info (command git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree HEAD ^/dev/null) diff --git a/share/functions/__fish_hg_prompt.fish b/share/functions/__fish_hg_prompt.fish index 831f37e47..ee02d2b9b 100644 --- a/share/functions/__fish_hg_prompt.fish +++ b/share/functions/__fish_hg_prompt.fish @@ -23,7 +23,7 @@ set -g fish_prompt_hg_status_order added modified copied deleted untracked unmer function __fish_hg_prompt --description 'Write out the hg prompt' # If hg isn't installed, there's nothing we can do # Return 1 so the calling prompt can deal with it - if not command -s hg >/dev/null + if not command -sq hg return 1 end diff --git a/share/functions/__fish_print_addresses.fish b/share/functions/__fish_print_addresses.fish index ddc9ef5c1..356c8559c 100644 --- a/share/functions/__fish_print_addresses.fish +++ b/share/functions/__fish_print_addresses.fish @@ -1,7 +1,7 @@ function __fish_print_addresses --description "Print a list of known network addresses" - if command -s ip >/dev/null + if command -sq ip command ip --oneline address | cut -d" " -f7 | sed "s:\(.*\)/.*:\1:" - else if command -s ifconfig >/dev/null + else if command -sq ifconfig # This is for OSX/BSD # There's also linux ifconfig but that has at least two different output formats # is basically dead, and ip is installed on everything now diff --git a/share/functions/__fish_svn_prompt.fish b/share/functions/__fish_svn_prompt.fish index 243c02285..5c649c2cd 100644 --- a/share/functions/__fish_svn_prompt.fish +++ b/share/functions/__fish_svn_prompt.fish @@ -91,7 +91,7 @@ end function __fish_svn_prompt --description "Prompt function for svn" # if svn isn't installed then don't do anything - if not command -s svn >/dev/null + if not command -sq svn return 1 end diff --git a/share/functions/__terlar_git_prompt.fish b/share/functions/__terlar_git_prompt.fish index 32ffff9e9..46013d928 100644 --- a/share/functions/__terlar_git_prompt.fish +++ b/share/functions/__terlar_git_prompt.fish @@ -23,7 +23,7 @@ set -g fish_prompt_git_status_order added modified renamed copied deleted untrac function __terlar_git_prompt --description 'Write out the git prompt' # If git isn't installed, there's nothing we can do # Return 1 so the calling prompt can deal with it - if not command -s git >/dev/null + if not command -sq git return 1 end set -l branch (git rev-parse --abbrev-ref HEAD ^/dev/null) diff --git a/share/functions/fish_indent.fish b/share/functions/fish_indent.fish index 03e30995a..0af0d726d 100644 --- a/share/functions/fish_indent.fish +++ b/share/functions/fish_indent.fish @@ -1,6 +1,6 @@ # check if command fish_indent works and is the same version that # came with this fish. This will happen one time. -command -s fish_indent >/dev/null +command -sq fish_indent and command fish_indent --version 2>&1 | string match -rq $FISH_VERSION # if alias doesn't define the function here, this is an autoloaded "nothing". # the command (if there is one) will be used by default. diff --git a/share/functions/fish_key_reader.fish b/share/functions/fish_key_reader.fish index 0cf5b29a7..da9b4488b 100644 --- a/share/functions/fish_key_reader.fish +++ b/share/functions/fish_key_reader.fish @@ -1,6 +1,6 @@ # check if command fish_key_reader works and is the same version that # came with this fish. This will happen one time. -command -s fish_key_reader >/dev/null +command -sq fish_key_reader and command fish_key_reader --version 2>&1 | string match -rq $FISH_VERSION # if alias doesn't define the function here, this is an autoloaded "nothing". # the command (if there is one) will be used by default. diff --git a/share/functions/ls.fish b/share/functions/ls.fish index 7418195f4..4a6b0db3d 100644 --- a/share/functions/ls.fish +++ b/share/functions/ls.fish @@ -12,7 +12,7 @@ if command ls --version >/dev/null ^/dev/null end if not set -q LS_COLORS - if command -s dircolors >/dev/null + if command -sq dircolors set -l colorfile for file in ~/.dir_colors ~/.dircolors /etc/DIR_COLORS if test -f $file diff --git a/share/functions/open.fish b/share/functions/open.fish index 6e606aeba..e878435ee 100644 --- a/share/functions/open.fish +++ b/share/functions/open.fish @@ -3,7 +3,7 @@ # application for the file. # -if not command -s open >/dev/null +if not command -sq open function open --description "Open file in default application" if count $argv >/dev/null switch $argv[1] diff --git a/share/functions/realpath.fish b/share/functions/realpath.fish index f1f6743b6..9ab853a5c 100644 --- a/share/functions/realpath.fish +++ b/share/functions/realpath.fish @@ -6,7 +6,7 @@ # external command by that name. That's because if we don't the parser will select our builtin. # However, we only want our builtin if there is no external realpath command. -if command -s realpath >/dev/null +if command -sq realpath function realpath -w realpath -d "print the resolved path [command realpath]" command realpath $argv end @@ -14,7 +14,7 @@ if command -s realpath >/dev/null end # If there is a HomeBrew installed version of GNU realpath named grealpath use that. -if command -s grealpath >/dev/null +if command -sq grealpath function realpath -w grealpath -d "print the resolved path [command grealpath]" command grealpath $argv end diff --git a/share/functions/seq.fish b/share/functions/seq.fish index 4d2af7541..316605e9a 100644 --- a/share/functions/seq.fish +++ b/share/functions/seq.fish @@ -1,7 +1,7 @@ # If seq is not installed, then define a function that invokes __fish_fallback_seq # We can't call type here because that also calls seq -if not command -s seq >/dev/null +if not command -sq seq # No seq command function seq --description "Print sequences of numbers" __fish_fallback_seq $argv