mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 10:43:47 +08:00
funcsave: Fixed error and help handling.
Renamed references to the previous command name of save_function to funcsave, and returned an error after printing the help text when no arguments are specified.
This commit is contained in:
parent
164144f126
commit
fd4ac87382
|
@ -4,11 +4,13 @@ function funcsave --description "Save the current definition of all specified fu
|
||||||
if count $argv >/dev/null
|
if count $argv >/dev/null
|
||||||
switch $argv[1]
|
switch $argv[1]
|
||||||
case -h --h --he --hel --help
|
case -h --h --he --hel --help
|
||||||
__fish_print_help save_function
|
__fish_print_help funcsave
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
__fish_print_help save_function
|
printf (_ "%s: Expected function name\n") funcsave
|
||||||
|
__fish_print_help funcsave
|
||||||
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l res 0
|
set -l res 0
|
||||||
|
@ -21,7 +23,7 @@ function funcsave --description "Save the current definition of all specified fu
|
||||||
for i in $configdir $configdir/fish $configdir/fish/functions
|
for i in $configdir $configdir/fish $configdir/fish/functions
|
||||||
if not test -d $i
|
if not test -d $i
|
||||||
if not command mkdir $i >/dev/null
|
if not command mkdir $i >/dev/null
|
||||||
printf (_ "%s: Could not create configuration directory\n") save_function
|
printf (_ "%s: Could not create configuration directory\n") funcsave
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -32,7 +34,7 @@ function funcsave --description "Save the current definition of all specified fu
|
||||||
functions $i > $configdir/fish/functions/$i.fish
|
functions $i > $configdir/fish/functions/$i.fish
|
||||||
functions -e $i
|
functions -e $i
|
||||||
else
|
else
|
||||||
printf (_ "%s: Unknown function '%s'\n") save_function $i
|
printf (_ "%s: Unknown function '%s'\n") funcsave $i
|
||||||
set res 1
|
set res 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user