From 4a6592597aa3b8babf65b8120abd3385c7d924de Mon Sep 17 00:00:00 2001 From: Asger Hautop Drewsen Date: Mon, 28 Oct 2013 17:18:08 +0100 Subject: [PATCH] Make type -a print all executables in PATH --- share/functions/type.fish | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/share/functions/type.fish b/share/functions/type.fish index 6eb1a66f4..4a4c77031 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