Change run func's name
This commit is contained in:
parent
337d90a8c6
commit
2e8e7dad68
10
sw
10
sw
|
@ -9,10 +9,10 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
function main
|
function main
|
||||||
run_command $cmd_func_prefix $argv
|
run_swim_command $cmd_func_prefix $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
function run_command -a prefix
|
function run_swim_command -a prefix
|
||||||
argparse --ignore-unknown 'h/help' -- $argv
|
argparse --ignore-unknown 'h/help' -- $argv
|
||||||
set -l command $argv[2]
|
set -l command $argv[2]
|
||||||
set -l func $prefix\_$command
|
set -l func $prefix\_$command
|
||||||
|
@ -48,13 +48,13 @@ function define_included_functions -a prefix
|
||||||
test -z "$command"; and continue
|
test -z "$command"; and continue
|
||||||
set -l command (string trim "$command")
|
set -l command (string trim "$command")
|
||||||
|
|
||||||
echo \n"Running '$command' ..."
|
echo "Running '$command' ..."
|
||||||
run_command $prefix (string split ' ' $command)
|
run_swim_command $prefix (string split ' ' $command)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function _$prefix\_commands -V prefix -d 'List all available commands'
|
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
|
for name in $names
|
||||||
set -l details (functions -D -v $name)
|
set -l details (functions -D -v $name)
|
||||||
|
|
|
@ -64,7 +64,7 @@ function swim_hello -d 'This is an example of a subgroup of commands'
|
||||||
|
|
||||||
alias hello_default='hello_world'
|
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
|
end
|
||||||
|
|
||||||
function swim_fails -d 'This command fails every time'
|
function swim_fails -d 'This command fails every time'
|
||||||
|
|
Loading…
Reference in New Issue