all repos — scriptura @ v0.0.2

a corner in $HOME for your scripts

functions/__scriptura_complete_script.fish (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function __scriptura_complete_script
    set --function from $SCRIPTURA_ROOT

    test (count $argv) -ne 0
    or set --function argv (commandline -xpc)[2..]

    argparse --move-unknown n/new -- $argv

    for arg in $argv
        if path is --type dir $from/$arg
            set --function from $from/$arg
        else if path is --type file $from/$arg
            return
        end
    end

    set --function types file,dir
    if set --query _flag_new
        set --function types dir
    end

    for entry in $(path filter --type $types --perm exec $from/*)
        printf "%s\t%s\n" $(path basename $entry) $(__scriptura_help $entry)
    end
end