all repos — scriptura @ e2bef6abcb519abcc37d0024d08319b20f76d6b1

a corner in $HOME for your scripts

print which variable was used to define SCRIPTURA_ROOT

Alin
commit

e2bef6abcb519abcc37d0024d08319b20f76d6b1

parent

db065bc49d2639788545b2e9060d45c82e78c99c

1 file changed, 19 insertions(+), 10 deletions(-)

changed files
M functions/scriptura.fishfunctions/scriptura.fish
@@ -1,26 +1,35 @@
-if not set --query SCRIPTURA_ROOT - if set --query SD_ROOT - set --global SCRIPTURA_ROOT $SD_ROOT - else - set --global SCRIPTURA_ROOT "$HOME/sd" +function scriptura + set --function valid_subcommands run help new edit which cat + + if not set --query --function scriptura_root_var + if not set --query SCRIPTURA_ROOT; and set --query SD_ROOT + set --function scriptura_root_var SD_ROOT + else + set --function scriptura_root_var SCRIPTURA_ROOT + end end -end -function scriptura - set --function valid_subcommands run help new edit which cat + set --function SCRIPTURA_ROOT $$scriptura_root_var + if test -z "$SCRIPTURA_ROOT" + set --function SCRIPTURA_ROOT $HOME/sd + end if not path is $SCRIPTURA_ROOT if test "$argv[1]" = new mkdir $SCRIPTURA_ROOT return 0 else - echo \$SCRIPTURA_ROOT $SCRIPTURA_ROOT does not exist, use `$(status function) new` to create it + echo $scriptura_root_var $SCRIPTURA_ROOT does not exist, use `$(status function) new` to create it return 1 end end if not count $argv >/dev/null - __scriptura_usage $valid_subcommands + printf 'Usage: %s [run] <script_name>\n' (status current-command) + printf '%s: %s\n' $scriptura_root_var $SCRIPTURA_ROOT + printf '\n' + + __scriptura_list $SCRIPTURA_ROOT return 0 end