Extract CD/DVD completion from k3b into general functions, use them in mplayer.

This commit is contained in:
Ville Skyttä 2009-11-04 23:12:44 +02:00
parent db7d2833df
commit 36eb06af6b
4 changed files with 29 additions and 8 deletions

View File

@ -19,8 +19,8 @@ bash-completion (2.x)
* Apply cardctl completion to pccardctl too.
* Apply pine completion to alpine too.
* Remove many unnecessary short option completions where long ones exist.
* Improve configure, cvs, gkrellm, lftp, mdadm, mysqladmin, service, and
ssh completions.
* Improve configure, cvs, gkrellm, lftp, mdadm, mplayer, mysqladmin, service,
and ssh completions.
* Add abook and wtf completion, based on work by Raphaël Droz.
* Add k3b and lftpget completion.
* Don't overwrite other host completions when completing from multiple

View File

@ -727,6 +727,20 @@ _usb_ids()
"$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ) )
}
# CD device names
_cd_devices()
{
COMPREPLY=( "${COMPREPLY[@]}"
$( compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}" ) )
}
# DVD device names
_dvd_devices()
{
COMPREPLY=( "${COMPREPLY[@]}"
$( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" ) )
}
# start of section containing completion functions for external programs
# a little help for FreeBSD ports users

View File

@ -15,14 +15,12 @@ _k3b()
return 0
;;
--copydvd|--formatdvd|--videodvdrip)
cur=${cur:=/dev/}
COMPREPLY=( $( compgen -f -d -X "!*/?(r)dvd*" -- "$cur" ) )
_dvd_devices
return 0
;;
--copycd|--erasecd|--cddarip|--videocdrip)
cur=${cur:=/dev/}
COMPREPLY=( $( compgen -f -d -X "!*/@(?([amrs])cd|?(r)dvd)*" \
-- "$cur" ) )
_cd_devices
_dvd_devices
return 0
;;
--cdimage|--image)

View File

@ -77,7 +77,16 @@ _mplayer()
IFS=$' \t\n'
return 0
;;
-@(mixer|@(cdrom|dvd)-device|dvdauth|fb|zrdev))
-cdrom-device)
_cd_devices
_dvd_devices
return 0
;;
-dvd-device)
_dvd_devices
return 0
;;
-@(mixer|dvdauth|fb|zrdev))
cur=${cur:=/dev/}
_filedir
return 0