/mpv-bash-completion

Bash completion for the mpv video player

Primary LanguageShellGNU General Public License v3.0GPL-3.0

mpv-bash-completion

A script for generating a Bash completion script for the popular mpv video player. It features...

  • Completion for all --options,
  • Type-based completion for --option arguments for choices, flags, integers and floats,
  • Completion for upper/lower bounds for integer- and float-type argument ranges where applicable,
  • Regular file name completion.

It does so by parsing the output of

mpv --list-options

directly and should thus work against all recent versions of mpv.

Included is support for generating Arch (PKGBUILD) and Debian (checkinstall) packages.

Dependencies

  • Bash 4
  • GNU core utilities
  • grep
  • make
  • mpv (must be in $PATH)

Generating the completion script

You can simply run the generation script in order to obtain a completion file. For Debian and Arch Linux, you can build a package which installs everything into the right places. Readily built Debian and Arch Linux packages are also provided.

Generic method

Running

./gen.sh > mpv

will produce a shell script in the current working directory. Source it in your .bashrc or similar like this:

source /bath/to/the/script

re-source your .bashrc:

source $HOME/.bashrc

and you should now have completion for the mpv command.

Building a Debian package

Instructions are included in the debian branch's README.

git checkout debian

and continue reading.

Building an Arch Linux package

Instructions are included in the arch branch's README.

git checkout arch

and continue reading.

License

gen.sh - mpv Bash completion script generator - This is a hack. Oh noes!
Copyright (C) 2014-2015 Jens Oliver John <dev at 2ion dot de>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.