File: __fish_gnu_complete.fish

package info (click to toggle)
fish 3.1.2-3%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 38,672 kB
  • sloc: ansic: 80,259; cpp: 47,069; javascript: 17,087; sh: 6,163; python: 3,429; makefile: 669; perl: 367; objc: 78; xml: 18
file content (52 lines) | stat: -rw-r--r-- 988 bytes parent folder | download | duplicates (2)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function __fish_gnu_complete -d "Wrapper for the complete built-in. Skips the long completions on non-GNU systems"
    set is_gnu 0

    set -l argv_out

    # Check if we are using a gnu system
    for i in $argv
        switch $i

            case -g --is-gnu
                set is_gnu 1

            case '*'
                set argv_out $argv_out $i
        end
    end

    set argv $argv_out
    set argv_out
    set -l skip_next 0

    # Remove long option if not on a gnu system
    switch $is_gnu
        case 0
            for i in $argv

                switch $skip_next

                    case 1
                        set skip_next 0
                        continue

                end

                switch $i

                    case -l --long
                        set skip_next 1
                        continue

                end

                set argv_out $argv_out $i
            end
            set argv $argv_out

    end

    complete $argv

end