mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Use 'type -f' instead of 'which' to test for presense of command, since the latter does not set the exit status correctly on all platforms
darcs-hash:20060314002127-ac50b-6ed726bdcc9e3a7a9608a904c382973799dc73ef.gz
This commit is contained in:
parent
99a93b5add
commit
d58b9de63b
4 changed files with 8 additions and 8 deletions
|
@ -3,7 +3,7 @@
|
||||||
# Alias for gettext (or a fallback if gettext isn't installed)
|
# Alias for gettext (or a fallback if gettext isn't installed)
|
||||||
#
|
#
|
||||||
|
|
||||||
if test -x (which gettext) ^/dev/null >/dev/null
|
if type -f gettext >/dev/null
|
||||||
function _ -d "Alias for the gettext command"
|
function _ -d "Alias for the gettext command"
|
||||||
gettext fish $argv
|
gettext fish $argv
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ function __fish_print_packages
|
||||||
#Get the word 'Package' in the current language
|
#Get the word 'Package' in the current language
|
||||||
set -l package (_ Package)
|
set -l package (_ Package)
|
||||||
|
|
||||||
if which apt-cache >/dev/null ^/dev/null
|
if type -f apt-cache >/dev/null
|
||||||
# Apply the following filters to output of apt-cache:
|
# Apply the following filters to output of apt-cache:
|
||||||
# 1) Remove package names with parentesis in them, since these seem to not correspond to actual packages as reported by rpm
|
# 1) Remove package names with parentesis in them, since these seem to not correspond to actual packages as reported by rpm
|
||||||
# 2) Remove package names that are .so files, since these seem to not correspond to actual packages as reported by rpm
|
# 2) Remove package names that are .so files, since these seem to not correspond to actual packages as reported by rpm
|
||||||
|
@ -25,7 +25,7 @@ function __fish_print_packages
|
||||||
# Rpm is too slow for this job, so we set it up to do completions
|
# Rpm is too slow for this job, so we set it up to do completions
|
||||||
# as a background job and cache the results.
|
# as a background job and cache the results.
|
||||||
|
|
||||||
if which rpm >/dev/null ^/dev/null
|
if type -f rpm >/dev/null
|
||||||
|
|
||||||
# If the cache is less than five minutes old, we do not recalculate it
|
# If the cache is less than five minutes old, we do not recalculate it
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ function __fish_print_packages
|
||||||
# This completes the package name from the portage tree.
|
# This completes the package name from the portage tree.
|
||||||
# True for installing new packages. Function for printing
|
# True for installing new packages. Function for printing
|
||||||
# installed on the system packages is in completions/emerge.fish
|
# installed on the system packages is in completions/emerge.fish
|
||||||
if which emerge >/dev/null ^/dev/null
|
if type -f emerge >/dev/null
|
||||||
emerge -s \^(commandline -tc) |grep "^*" |cut -d\ -f3 |cut -d/ -f2
|
emerge -s \^(commandline -tc) |grep "^*" |cut -d\ -f3 |cut -d/ -f2
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,7 +36,7 @@ function help -d (N_ "Show help for the fish shell")
|
||||||
else
|
else
|
||||||
# Check for a text-based browser.
|
# Check for a text-based browser.
|
||||||
for i in $text_browsers
|
for i in $text_browsers
|
||||||
if which $i 2>/dev/null >/dev/null
|
if type -f $i >/dev/null
|
||||||
set fish_browser $i
|
set fish_browser $i
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -46,7 +46,7 @@ function help -d (N_ "Show help for the fish shell")
|
||||||
# browser to use instead.
|
# browser to use instead.
|
||||||
if test "$DISPLAY" -a \( "$XAUTHORITY" = "$HOME/.Xauthority" -o "$XAUTHORITY" = "" \)
|
if test "$DISPLAY" -a \( "$XAUTHORITY" = "$HOME/.Xauthority" -o "$XAUTHORITY" = "" \)
|
||||||
for i in $graphical_browsers
|
for i in $graphical_browsers
|
||||||
if which $i 2>/dev/null >/dev/null
|
if type -f $i >/dev/null
|
||||||
set fish_browser $i
|
set fish_browser $i
|
||||||
set fish_browser_bg 1
|
set fish_browser_bg 1
|
||||||
break
|
break
|
||||||
|
@ -79,7 +79,7 @@ function help -d (N_ "Show help for the fish shell")
|
||||||
case $help_topics
|
case $help_topics
|
||||||
set fish_help_page "index.html\#$fish_help_item"
|
set fish_help_page "index.html\#$fish_help_item"
|
||||||
case "*"
|
case "*"
|
||||||
if which $fish_help_item >/dev/null ^/dev/null
|
if type -f $fish_help_item >/dev/null
|
||||||
man $fish_help_item
|
man $fish_help_item
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -119,7 +119,7 @@ function type -d (N_ "Print the type of a command")
|
||||||
printf (_ 'file\n')
|
printf (_ 'file\n')
|
||||||
|
|
||||||
case path
|
case path
|
||||||
which $i
|
echo $path
|
||||||
end
|
end
|
||||||
if test $selection != multi
|
if test $selection != multi
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue