Make type -a print all executables in PATH

This commit is contained in:
Asger Hautop Drewsen 2013-10-28 17:18:08 +01:00 committed by David Adam
parent afb9401fc7
commit 4a6592597a

View File

@ -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