[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 36eb06af6bdef206e35df4dddbcb8eb4b8e9ab0e
Ville Skyttä
ville.skytta at iki.fi
Wed Nov 4 21:43:32 UTC 2009
The following commit has been merged in the master branch:
commit 36eb06af6bdef206e35df4dddbcb8eb4b8e9ab0e
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Wed Nov 4 23:12:44 2009 +0200
Extract CD/DVD completion from k3b into general functions, use them in mplayer.
diff --git a/CHANGES b/CHANGES
index 2ed5855..41bcbfd 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 506c9c2..8c054a1 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 54c4737..5c6269f 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 b8e17a6..7f0cf3f 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
--
bash-completion
More information about the Bash-completion-commits
mailing list