all repos — scriptura @ 67c5dc65972ef72d72080ea7792296971c8f388c

a corner in $HOME for your scripts

extract completion helper functions

Alan Pearce
commit

67c5dc65972ef72d72080ea7792296971c8f388c

parent

c45b4ea656064fa445843ab7885f814350232446

1 file changed, 0 insertions(+), 38 deletions(-)

changed files
M completions/scriptura.fishcompletions/scriptura.fish
@@ -40,41 +40,3 @@
complete --command scriptura \ --condition '__scriptura_seen_script $(commandline -xpc)' \ --force-files - -function __scriptura_print --argument-names from - path basename $(path filter --type file,dir --perm exec $from/*) -end - -function __scriptura_complete --argument-names from - for arg in $argv[2..-1] - if path is --type dir $from/$arg - set --function from $from/$arg - end - end - for entry in $(path filter --type file,dir --perm exec $from/*) - printf "%s\t%s\n" $(path basename $entry) $(__scriptura_help $entry) - end -end - -function __scriptura_seen_script - set --function argv $argv[2..-1] - set --function target $SCRIPTURA_ROOT - - if not set --query argv[1] - return 1 - end - - for i in (seq 1 (count $argv)) - if test "$argv[$i]" = -- - break - else if path is --type dir $target/$argv[$i] - set --function target $target/$argv[$i] - else if path is --type file --perm exec $target/$argv[$i] - return 0 - else - break - end - end - - return 1 -end