discard custom colors of selected items also in classic display mode
[ncmpcpp.git] / doc / ncmpcpp-completion.bash
blob49222c4b4a8b2e62fd9142ad6b5fd6227822a21f
1 # Installation:
2 # - If you have system bash completion, place this in /etc/bash_completion.d or
3 # source it from $HOME/.bash_completion
4 # - If you don't have system bash completion, source this from your .bashrc
6 _ncmpcpp ()
8 local cur prev cmds opts
10 cur="$2"
11 prev="$3"
12 cmds=`ncmpcpp --help 2>&1 | awk '/^ [a-z]+ /{print $1}'`;
13 opts="`ncmpcpp --help 2>&1 | awk '/^ -.+,/{print $1 "\n" $2}' | sed -e 's/,//;$a--now-playing'`"
15 case "$prev" in
16 ncmpcpp)
17 COMPREPLY=($(compgen -W '$opts $cmds' -- "$cur"))
19 --port|-p|--host|-h)
20 COMPREPLY=()
22 --help|-?|--version|-v|--now-playing)
23 return
25 next|pause|play|prev|stop|toggle|volume)
26 opts="`echo $opts | sed -e 's/--port//;s/--host//;s/-p//;s/-h//'`"
27 COMPREPLY=($(compgen -W '$opts' -- "$cur"))
30 COMPREPLY=($(compgen -W '$opts $cmds' -- "$cur"))
32 esac
34 complete -F _ncmpcpp ncmpcpp