summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2012-01-15 14:24:38 +0200
committerVille Skyttä <ville.skytta@iki.fi>2012-01-15 14:24:38 +0200
commit45c0886accafd08272fa17c5daad85a1ee52cd56 (patch)
tree68bd8eec97ff9285a7052a7d496b0a63a22910d3
parenta90d7d861a53fa7aee6be505678cd43fb578cafc (diff)
downloadbash-completion-45c0886accafd08272fa17c5daad85a1ee52cd56.tar.gz
mplayer: Add generic handling of options that take arguments.
-rw-r--r--completions/mplayer11
1 files changed, 11 insertions, 0 deletions
diff --git a/completions/mplayer b/completions/mplayer
index 85d11b09..ba8e3e90 100644
--- a/completions/mplayer
+++ b/completions/mplayer
@@ -243,6 +243,17 @@ _mplayer()
COMPREPLY=( $( compgen -W 'all gui system user' -- "$cur" ) )
return 0
;;
+ -*)
+ # Assume arg is required for everything else except options
+ # for which -list-options says Type is Flag or Print.
+ $cmd -nomsgcolor -nomsgmodule -list-options 2>/dev/null \
+ | while read -r i j k; do
+ if [[ $i == ${prev#-} ]]; then
+ [[ ${j,,} != @(flag|print) ]] && return 1
+ break
+ fi
+ done || return 0
+ ;;
esac
case $cur in