-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathncmpcpp.bash-completion
50 lines (46 loc) · 1.36 KB
/
ncmpcpp.bash-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
41
42
43
44
45
46
47
48
49
50
# Installation:
# - If you have system bash completion, place this in /etc/bash_completion.d or
# source it from $HOME/.bash_completion
# - If you don't have system bash completion, source this from your .bashrc
_ncmpcpp ()
{
local cur prev cmds opts
cur="$2"
prev="$3"
cmds=`ncmpcpp --help 2>&1 | awk '/^ [a-z]+ /{print $1}'`;
opts=`_parse_help ncmpcpp`
case "$prev" in
ncmpcpp)
case "$cur" in
-*)
COMPREPLY=($(compgen -W '$opts' -- "$cur"))
;;
*)
COMPREPLY=($(compgen -W '$cmds' -- "$cur"))
;;
esac
;;
--port|-p|--host|-h)
COMPREPLY=()
;;
--help|-?|--version|-v|--now-playing)
return
;;
next|pause|play|prev|stop|toggle|volume)
opts="`echo $opts | sed -e 's/--port//;s/--host//;s/-p//;s/-h//'`"
COMPREPLY=($(compgen -W '$opts' -- "$cur"))
;;
*)
case "$cur" in
-*)
COMPREPLY=($(compgen -W '$opts' -- "$cur"))
;;
*)
COMPREPLY=($(compgen -W '$cmds' -- "$cur"))
;;
esac
;;
esac
}
complete -F _ncmpcpp ncmpcpp
# vim: set ft=sh tw=80 sw=4 et :