From a3f28e221f55ede25e45f2f581c1962bfb0ecaf0 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 24 Mar 2017 17:26:32 +0100 Subject: [PATCH] type: Remove need for `which` This should be completely equivalent without needing an external command. --- share/functions/type.fish | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/functions/type.fish b/share/functions/type.fish index ab0cd28b1..3acfa067d 100644 --- a/share/functions/type.fish +++ b/share/functions/type.fish @@ -123,7 +123,13 @@ function type --description "Print the type of a command" if test $multi != yes set paths (command -s -- $i) else - set paths (command which -a -- $i ^/dev/null) + # TODO: This should really be `command -sa`. + # TODO: If #3914 ('Treat empty $PATH component as equivalent to "." ') + # is implemented, this needs to change as well. + for file in $PATH/* + test -x $file -a ! -d $file + and set paths $paths $file + end end for path in $paths set res 0