diff --git a/run b/run index 690caa5..8523b23 100755 --- a/run +++ b/run @@ -10,6 +10,7 @@ else end function main + alias $run_func_prefix\_default=$run_func_prefix\_help define_aliases for command in $argv @@ -26,7 +27,7 @@ end function execute_command -a prefix command set -l args (string split --max 1 $run_arg_delimeter $command) - set -l func $prefix'_'$args[1] + set -l func $prefix\_$args[1] define_default_functions $prefix @@ -43,13 +44,13 @@ end function define_default_functions set -g prefix $argv[1] - function "$prefix"_commands -d 'List all available commands' - set -l names (functions --names | grep $prefix'_') + function _$prefix\_commands -d 'List all available commands' + set -l names (functions --names | grep $prefix\_) for name in $names set -l details (functions -D -v $name) set -l description $details[5] - set -l short_name (string replace "$prefix"_ '' $name) + set -l short_name (string replace $prefix\_ '' $name) if test (string length $short_name) -ge 8 echo $short_name\t$description @@ -59,13 +60,13 @@ function define_default_functions end end - function "$prefix"_help -a command -d 'Print command definition' + function $prefix\_help -a command -d 'Print help menu or command definition' if test -n "$command" - functions $prefix'_'$command + functions $prefix\_$command else echo 'Here are the available commands:'\n - "$prefix"_commands - echo \n"To see a command's definition and description do `run help$run_arg_delimeter{command}`" + _$prefix\_commands + echo \n"To see a command's definition do `run help$run_arg_delimeter{command}`" echo "To see a subcommand group's help menu do `run {command}$run_arg_delimeter""help`" end end diff --git a/run.fish b/run.fish index 990283c..6f40c78 100644 --- a/run.fish +++ b/run.fish @@ -8,7 +8,13 @@ set -g run_arg_delimeter ':' function define_aliases - alias run_default='run_install' + alias run_default='run_help' + + alias run_i='run_install' + alias run_l='run_lint' + alias run_f='run_format' + alias run_h='run_hello' + alias hello_w='hello_world' end