File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,7 @@ case $state in
192192
193193 parse-help-* )
194194 local option_name=${state# parse-help-}
195+ local no_config=" --no-config"
195196 # Can't do non-capturing groups without pcre, so we index the ones we want
196197 local pattern name_group=1 desc_group=2
197198 case $option_name in
@@ -203,6 +204,8 @@ case $state in
203204 # but would break if a profile name contained spaces. This stricter one
204205 # only breaks if a profile name contains tabs.
205206 pattern=$' ^\t ([^\t ]*)\t (.*)'
207+ # We actually want config so we can autocomplete the user's profiles
208+ no_config=" "
206209 ;;
207210 * )
208211 pattern=$' ^[ \t ]+(--' ${option_name} $' =)?([^ \t ]+)[ \t ]*[-:]?[ \t ]*(.*)'
@@ -211,7 +214,7 @@ case $state in
211214 esac
212215 local -a values
213216 local current
214- for current in " ${(@ f)$($~words[1] --no-config --${option_name} =help)} " ; do
217+ for current in " ${(@ f)$($~words[1] ${no_config} --${option_name} =help)} " ; do
215218 [[ $current =~ $pattern ]] || continue ;
216219 local name=${match[name_group]//:/ \\ : } desc=${match[desc_group]}
217220 if [[ -n $desc ]]; then
Original file line number Diff line number Diff line change @@ -26,8 +26,10 @@ _mpv_get_args()
2626 local partial=" $2 "
2727 local type=$( echo " $doc " | awk ' {print $2;}' )
2828
29+ # We special-case profiles to ensure we read the config
2930 if [ " $1 " = " --show-profile" ]; then
30- # This is a special case
31+ type=" ShowProfile"
32+ elif [ " $1 " = " --profile" ]; then
3133 type=" Profile"
3234 fi
3335
@@ -59,7 +61,11 @@ _mpv_get_args()
5961 candidates+=(" help" )
6062 ;;
6163 Profile)
62- candidates=($( mpv --no-config $1 = | grep -v ' :' | awk ' {print $1;}' ) )
64+ candidates=($( mpv $1 =help | grep -v ' :' | awk ' {print $1;}' ) )
65+ candidates+=(" help" )
66+ ;;
67+ ShowProfile)
68+ candidates=($( mpv $1 = | grep -v ' :' | awk ' {print $1;}' ) )
6369 ;;
6470 * )
6571 # There are other categories; some of which we could do something smarter
You can’t perform that action at this time.
0 commit comments