-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadcl-completion.bash
More file actions
55 lines (43 loc) · 1.11 KB
/
Copy pathadcl-completion.bash
File metadata and controls
55 lines (43 loc) · 1.11 KB
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
#!/bin/bash
_episodes_completion() {
actions="download list"
COMPREPLY=($(compgen -W "$actions" "${COMP_WORDS[${COMP_CWORD}]}"))
if [ ${COMP_CWORD} -gt 2 ]; then
# check flags here
action=${COMP_WORDS[2]}
if [ "$action" = "download" ]; then
COMPREPLY=($(compgen -W "<episode_list> -h" "${COMP_WORDS[${COMP_CWORD}]}"))
else
COMPREPLY=()
fi
fi
}
_music_completion() {
actions="download list"
COMPREPLY=($(compgen -W "$actions" "${COMP_WORDS[${COMP_CWORD}]}"))
if [ ${COMP_CWORD} -gt 2 ]; then
# check flags here
action=${COMP_WORDS[2]}
if [ "$action" = "download" ]; then
COMPREPLY=($(compgen -W "<music_id_list> -h" "${COMP_WORDS[${COMP_CWORD}]}"))
else
COMPREPLY=()
fi
fi
}
_adcl_completions() {
subcommands="episodes music"
COMPREPLY=($(compgen -W "$subcommands" "${COMP_WORDS[1]}"))
if [ ${COMP_CWORD} -gt 1 ]; then
command=${COMP_WORDS[1]}
case "$command" in
"episodes")
_episodes_completion
;;
"music")
_music_completion
;;
esac
fi
}
complete -F _adcl_completions adcl