diff --git a/sw b/sw index 2436ae8..93d7669 100755 --- a/sw +++ b/sw @@ -9,10 +9,10 @@ else end function main - run_command $cmd_func_prefix $argv + run_swim_command $cmd_func_prefix $argv end -function run_command -a prefix +function run_swim_command -a prefix argparse --ignore-unknown 'h/help' -- $argv set -l command $argv[2] set -l func $prefix\_$command @@ -48,13 +48,13 @@ function define_included_functions -a prefix test -z "$command"; and continue set -l command (string trim "$command") - echo \n"Running '$command' ..." - run_command $prefix (string split ' ' $command) + echo "Running '$command' ..." + run_swim_command $prefix (string split ' ' $command) end end function _$prefix\_commands -V prefix -d 'List all available commands' - set -l names (functions --names | grep $prefix\_) + set -l names (functions --names | grep "^$prefix\_") for name in $names set -l details (functions -D -v $name) diff --git a/swim.fish b/swim.fish index ee8a1c7..4bccea6 100644 --- a/swim.fish +++ b/swim.fish @@ -64,7 +64,7 @@ function swim_hello -d 'This is an example of a subgroup of commands' alias hello_default='hello_world' - run_command 'hello' $argv # this command comes from the sw script + run_swim_command 'hello' $argv # this command comes from the sw script end function swim_fails -d 'This command fails every time'