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
8 local cur prev cmds opts
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'`"
17 COMPREPLY
=($
(compgen
-W '$opts $cmds' -- "$cur"))
22 --help|
-?|
--version|
-v|
--now-playing)
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"))
34 complete
-F _ncmpcpp ncmpcpp