aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/type.fish
diff options
context:
space:
mode:
authorGravatar Asger Hautop Drewsen <asgerdrewsen@gmail.com>2013-10-28 17:18:08 +0100
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2013-10-29 13:32:14 +0800
commit4a6592597aa3b8babf65b8120abd3385c7d924de (patch)
tree4d5399800152ace0db39ff471dd14d845f768dec /share/functions/type.fish
parentafb9401fc76fb959fd937b5848c687f6290a3a66 (diff)
Make type -a print all executables in PATH
Diffstat (limited to 'share/functions/type.fish')
-rw-r--r--share/functions/type.fish27
1 files changed, 17 insertions, 10 deletions
diff --git a/share/functions/type.fish b/share/functions/type.fish
index 6eb1a66f..4a4c7703 100644
--- a/share/functions/type.fish
+++ b/share/functions/type.fish
@@ -117,22 +117,29 @@ function type --description "Print the type of a command"
end
- set -l path (which $i ^/dev/null)
- if test -x (echo $path)
- set res 0
- set found 1
- switch $mode
- case normal
- printf (_ '%s is %s\n') $i $path
+ set -l paths
+ if test $selection != multi
+ set paths (which $i ^/dev/null)
+ else
+ set paths (which -a $i ^/dev/null)
+ end
+ for path in $paths
+ if test -x (echo $path)
+ set res 0
+ set found 1
+ switch $mode
+ case normal
+ printf (_ '%s is %s\n') $i $path
case type
echo (_ 'file')
case path
echo $path
- end
- if test $selection != multi
- continue
+ end
+ if test $selection != multi
+ continue
+ end
end
end