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:
Dylan Smith 2010-11-20 01:42:11 -05:00 committed by Grissiom
parent 164144f126
commit fd4ac87382

View File

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