diff --git a/functions/sw.fish b/functions/sw.fish index 96437c2..1ffb0ee 100644 --- a/functions/sw.fish +++ b/functions/sw.fish @@ -40,7 +40,9 @@ function run_swim_command -a prefix else if functions -q $prefix\_default $prefix\_default $args else - echo "$prefix command '$command' does not exist" + echo " +$prefix command '$command' does not exist +Try 'help' command or -h/--help flags" return 127 end end @@ -50,11 +52,15 @@ function define_included_functions -a prefix function $prefix\_do -V prefix -d 'Perform a list of commands separated by commas' for command in (string split ',' "$argv") - test -z "$command"; and continue + if test -z "$command" + continue + end + set -l command (string trim "$command") echo "Running '$command' ..." run_swim_command $prefix (string split ' ' $command) + or return $status end end @@ -85,12 +91,6 @@ function define_included_functions -a prefix end end - if not functions -q $prefix\_default - function $prefix\_default -a arg -V prefix -d 'Alias for help command' - $prefix\_help $arg - end - end - function $prefix\_is_group -d 'Tells executor whether this is a subcommand group' echo 'is-group' end diff --git a/sw b/sw index ce9aab8..01fe0ac 100755 --- a/sw +++ b/sw @@ -41,7 +41,9 @@ function run_swim_command -a prefix else if functions -q $prefix\_default $prefix\_default $args else - echo "$prefix command '$command' does not exist" + echo " +$prefix command '$command' does not exist +Try 'help' command or -h/--help flags" return 127 end end @@ -51,11 +53,15 @@ function define_included_functions -a prefix function $prefix\_do -V prefix -d 'Perform a list of commands separated by commas' for command in (string split ',' "$argv") - test -z "$command"; and continue + if test -z "$command" + continue + end + set -l command (string trim "$command") echo "Running '$command' ..." run_swim_command $prefix (string split ' ' $command) + or return $status end end @@ -86,12 +92,6 @@ function define_included_functions -a prefix end end - if not functions -q $prefix\_default - function $prefix\_default -a arg -V prefix -d 'Alias for help command' - $prefix\_help $arg - end - end - function $prefix\_is_group -d 'Tells executor whether this is a subcommand group' echo 'is-group' end diff --git a/swim.fish.example b/swim.fish.example index c2f43b3..92dd8d8 100644 --- a/swim.fish.example +++ b/swim.fish.example @@ -44,11 +44,11 @@ function swim_install -d 'Install the sw script to a bin folder' end function swim_lint -d 'Lint fish scripts' - fish --no-execute ./sw ./swim.fish + fish --no-execute ./sw ./**.fish end function swim_format -d 'Format fish scripts' - fish_indent --write ./sw ./swim.fish + fish_indent --write ./sw ./**.fish end function swim_hello -d 'This is an example of a subgroup of commands'