allow users to write their own subcommands
1 file changed, 15 insertions(+), 0 deletions(-)
changed files
M functions/scriptura.fish → functions/scriptura.fish
@@ -33,6 +33,15 @@ echo "" for subcommand in $valid_subcommands printf ' %-12s %s\n' $subcommand (__scriptura_describe_function __scriptura_$subcommand) end + set --local user_subcommands (__scriptura_subcommands scriptura) + if count $user_subcommands >/dev/null + echo "" + echo "User Subcommands:" + echo "" + for subcommand in $user_subcommands + printf ' %-12s %s\n' $subcommand (__scriptura_desc $SCRIPTURA_ROOT/scriptura/$subcommand) + end + end echo "" echo "Scripts:" echo ""@@ -47,6 +56,9 @@ set --function subcommand $argv[1] if contains $subcommand $valid_subcommands + set --erase argv[1] + else if contains $subcommand (__scriptura_subcommands scriptura) + set --function cmd $subcommand set --erase argv[1] else echo Invalid subcommand: $subcommand >&2@@ -105,6 +117,9 @@ __scriptura_cat $target $remaining return $status case cmd __scriptura_cmd $target $remaining + return $status + case (__scriptura_subcommands scriptura) + __scriptura_cmd $target -- $cmd $remaining return $status end