From 45c0886accafd08272fa17c5daad85a1ee52cd56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 15 Jan 2012 14:24:38 +0200 Subject: mplayer: Add generic handling of options that take arguments. --- completions/mplayer | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 -- cgit v1.2.1