From a1c8bb2257c40bf2c69daea26cc6b10fde1a258d Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sat, 2 Sep 2023 16:00:34 -0700 Subject: {zsh,bash}-completion: use config when autocompleting profiles We were over-enthusiastic when introducing --no-config into the autocompletions. When autocompleting profiles, you actually need the config, because that's where the profiles come from. zsh is untested - I don't use it. --- etc/mpv.bash-completion | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'etc/mpv.bash-completion') diff --git a/etc/mpv.bash-completion b/etc/mpv.bash-completion index 55eed77ce1..d5d504acf9 100644 --- a/etc/mpv.bash-completion +++ b/etc/mpv.bash-completion @@ -26,8 +26,10 @@ _mpv_get_args() local partial="$2" local type=$(echo "$doc" | awk '{print $2;}') + # We special-case profiles to ensure we read the config if [ "$1" = "--show-profile" ]; then - # This is a special case + type="ShowProfile" + elif [ "$1" = "--profile" ]; then type="Profile" fi @@ -59,7 +61,11 @@ _mpv_get_args() candidates+=("help") ;; Profile) - candidates=($(mpv --no-config $1= | grep -v ':' | awk '{print $1;}')) + candidates=($(mpv $1=help | grep -v ':' | awk '{print $1;}')) + candidates+=("help") + ;; + ShowProfile) + candidates=($(mpv $1= | grep -v ':' | awk '{print $1;}')) ;; *) # There are other categories; some of which we could do something smarter -- cgit v1.2.3