Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions etc/mpv.bash-completion
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ _mpv_get_args()
type="ShowProfile"
elif [ "$1" = "--profile" ]; then
type="Profile"
elif [ "$1" = "--help" -o "$1" = "--h" ]; then
# --help=<substring> filters by option name, not String values
type="Help"
fi

declare -a candidates
Expand Down Expand Up @@ -70,6 +73,13 @@ _mpv_get_args()
ShowProfile)
candidates=($(mpv $1= | grep -v ':' | awk '{print $1;}'))
;;
Help)
# Mirror zsh help-options: bare option names (no "--"),
# excluding no-* and *-(add|append|clr|pre|set|remove|toggle).
candidates=($(_mpv_options | awk '{print $1;}' | grep '^--' | \
grep -vE '^--no-' | grep -vE '^--.*-(add|append|clr|pre|set|remove|toggle)$' | \
sed 's/^--//'))
;;
*)
# There are other categories; some of which we could do something smarter
# about, with enough work.
Expand All @@ -81,8 +91,11 @@ _mpv_get_args()
fi
}

# This regex detects special options where we don't want an '=' appended
_mpv_special_regex='\s(Flag.*\[not in config files\]|Print)'
# Options where '=' is not appended:
# - Print options and "not in config files" flags
# - list-type sub-options with no argument (e.g. --af-clr, --vo-help)
# --help/--h are intentionally excluded (they take a substring filter).
_mpv_special_regex='\s(Flag.*\[not in config files\]|Print)|^\s+--[[:alnum:]-]+-(clr|help)\s*$'
_mpv_skip_regex='\sremoved \[deprecated\]'

_mpv_regular_options()
Expand Down
Loading