mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 21:03:12 +00:00
Extend type --path
to print path to script defining named function
Expands the utility of `type -p foo` by allowing it to print the path to the script that defines `foo` when `foo` is a valid function that was sourced from a path on disk (rather than interactively defined). This does not change the behavior of `type -P`/`type --force-path`, which should have already been used if the desire was to resolve the path to an executable file (otherwise the output would have been blank if a function was shadowing an executable file of the same namea), so no backwards compatibility issues are expected.
This commit is contained in:
parent
8079345207
commit
d651cdacbe
1 changed files with 9 additions and 0 deletions
|
@ -56,6 +56,15 @@ function type --description 'Print the type of a command'
|
|||
end
|
||||
case type
|
||||
echo (_ 'function')
|
||||
case path
|
||||
set -l func_path (functions --details $i)
|
||||
switch $func_path
|
||||
case "n/a"
|
||||
case "stdin"
|
||||
break;
|
||||
case "*"
|
||||
echo $func_path
|
||||
end
|
||||
end
|
||||
if test $multi != yes
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue