]>
Commit | Line | Data |
---|---|---|
c6f8c3f5 SK |
1 | _flock_module() |
2 | { | |
3 | local cur prev OPTS | |
4 | COMPREPLY=() | |
5 | cur="${COMP_WORDS[COMP_CWORD]}" | |
6 | prev="${COMP_WORDS[COMP_CWORD-1]}" | |
7 | case $prev in | |
8 | '-w'|'--timeout') | |
9 | COMPREPLY=( $(compgen -W "seconds" -- $cur) ) | |
10 | return 0 | |
11 | ;; | |
12 | '-E'|'--conflict-exit-code') | |
d6b975ef | 13 | COMPREPLY=( $(compgen -W "{0..255}" -- $cur) ) |
c6f8c3f5 SK |
14 | return 0 |
15 | ;; | |
16 | '-c'|'--command') | |
17 | compopt -o bashdefault | |
18 | COMPREPLY=( $(compgen -c -- $cur) ) | |
19 | return 0 | |
20 | ;; | |
d4f9b8d7 VS |
21 | '-h'|'--help'|'-V'|'--version') |
22 | return 0 | |
23 | ;; | |
c6f8c3f5 SK |
24 | esac |
25 | case $cur in | |
26 | -*) | |
0d5b9b8a VS |
27 | OPTS="--shared |
28 | --exclusive | |
29 | --unlock | |
30 | --nonblock | |
31 | --timeout | |
32 | --conflict-exit-code | |
33 | --close | |
34 | --command | |
d092911b | 35 | --no-fork |
0d5b9b8a VS |
36 | --help |
37 | --version" | |
c6f8c3f5 SK |
38 | COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
39 | return 0 | |
40 | ;; | |
41 | esac | |
ce3e6b15 | 42 | local IFS=$'\n' |
c6f8c3f5 SK |
43 | compopt -o filenames |
44 | COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) | |
45 | return 0 | |
46 | } | |
47 | complete -F _flock_module flock |