diff --git a/CHANGES b/CHANGES index 2ed58556..41bcbfd9 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/bash_completion b/bash_completion index 506c9c25..8c054a1a 100644 --- a/bash_completion +++ b/bash_completion @@ -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 diff --git a/contrib/k3b b/contrib/k3b index 54c4737a..5c6269f4 100644 --- a/contrib/k3b +++ b/contrib/k3b @@ -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) diff --git a/contrib/mplayer b/contrib/mplayer index b8e17a6a..7f0cf3f2 100644 --- a/contrib/mplayer +++ b/contrib/mplayer @@ -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