-
Notifications
You must be signed in to change notification settings - Fork 0
/
assets.make.completion
40 lines (34 loc) · 1.05 KB
/
assets.make.completion
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
# bash completion for assets.make -*- shell-script -*-
_assets_make_complete_simple() {
COMPREPLY=($(compgen -W "$1" -- "$cur"))
[[ $COMPREPLY == *= ]] && compopt -o nospace
}
_assets_make_complete_open() {
COMPREPLY=($(compgen "$@"))
[[ $COMPREPLY == *= ]] && compopt -o nospace
}
_assets_make_() {
local cur prev #words cword split
_init_completion -s || return
local -r opts="$(assets.make --dump-options)"
# Handle options that need sub-options.
# Each option "case" should return immediately.
case "$prev" in
--fetch-timeout)
_assets_make_complete_open -P "$cur" -W "{0..9}"
;;
*)
# Handle all top-level parameters.
case "$cur" in
-* | "")
# Any option or nothing yet.
_assets_make_complete_simple "$opts"
;;
*)
# Non-option parameters.
;;
esac
;;
esac
} &&
complete -F _assets_make_ assets.make