File: bash_completion.in

package info (click to toggle)
gimp 3.2.0~RC2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 220,336 kB
  • sloc: ansic: 866,755; lisp: 10,855; python: 10,511; cpp: 7,330; perl: 4,469; sh: 1,439; xml: 965; yacc: 609; lex: 348; javascript: 150; makefile: 42
file content (91 lines) | stat: -rw-r--r-- 2,405 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
__gimp()
{
    COMPREPLY=()
    local current="${COMP_WORDS[COMP_CWORD]}"
    local prev="${COMP_WORDS[COMP_CWORD-1]}"

    # GIMP options, sorted alphabetically
    #
    # Note that we don't specify short options here, since they're quite unintuitive
    options=(
        "--as-new"
        "--batch"
        "--batch-interpreter"
        "--console-messages"
        "--debug-handlers"
        "--dump-gimprc"
        "--dump-gimprc-manpage"
        "--dump-gimprc-system"
        "--dump-pdb-procedures-deprecated"
        "--g-fatal-warnings"
        "--gimprc"
        "--help"
        "--help-all"
        "--help-gegl"
        "--help-gtk"
        "--license"
        "--new-instance"
        "--no-cpu-accel"
        "--no-data"
        "--no-fonts"
        "--no-interface"
        "--no-shm"
        "--no-splash"
        "--pdb-compat-mode"
        "--session"
        "--show-playground"
        "--show-debug-menu"
        "--stack-trace-mode"
        "--system-gimprc"
        "--verbose"
        "--version"
    )

    #
    # Different completions for specific options
    #
    case "${prev}" in
        # Options that shouldn't be used in combination with something else
        help | license | version)
            return 0
            ;;
        # Expect a filename
        gimprc | session | system-gimprc)
            COMPREPLY=( $(compgen -f -- ${current}) )
            return 0
            ;;
        # Expect *some* argument, so don't complete
        b | batch | display)
            return 0
            ;;
        batch-interpreter)
            # FIXME: we should try to get the list of interpreters somehow
            local interpreters=$(gimp --LIST_INTERPRETERS)
            COMPREPLY=("python-fu-eval" "plug-in-script-fu-eval")
            return 0
            ;;
        *)
        ;;
    esac

   # Default: complete with either an option "-W" or a filename "-f"
   COMPREPLY=($(compgen -W "${options[*]}" -f -- ${current}))
   return 0
}

complete -F __gimp @GIMP_MAIN_EXE@
if command -v @GIMP_SYMLINK1@ 2>&1 > /dev/null
then
  complete -F __gimp @GIMP_SYMLINK1@
  complete -F __gimp @GIMP_SYMLINK2@
fi

if command -v @GIMP_CONSOLE_EXE@ 2>&1 > /dev/null
then
  complete -F __gimp @GIMP_CONSOLE_EXE@
  if command -v @GIMP_CONSOLE_SYMLINK1@ 2>&1 > /dev/null
  then
    complete -F __gimp @GIMP_CONSOLE_SYMLINK1@
    complete -F __gimp @GIMP_CONSOLE_SYMLINK2@
  fi
fi