rework completion functions - read root from environment - enable testing by preferring argv over $(commandline -xpc)
1 file changed, 8 insertions(+), 6 deletions(-)
changed files
M functions/__scriptura_seen_script.fish → functions/__scriptura_seen_script.fish
@@ -1,17 +1,19 @@ function __scriptura_seen_script - set --function argv $argv[2..-1] + test (count $argv) -ne 0 + or set --function argv (commandline -xpc)[2..] + 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]" = -- + for arg in $argv + if test "$arg" = -- 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] + else if path is --type dir $target/$arg + set --function target $target/$arg + else if path is --type file --perm exec $target/$arg return 0 else break