[Bash-completion-commits] ./current r1267: new standalone mkinitrd completion

Guillaume Rousse guillomovitch at zarb.org
Mon Jan 19 20:31:54 UTC 2009


------------------------------------------------------------
revno: 1267
committer: Guillaume Rousse <guillomovitch at zarb.org>
branch nick: current
timestamp: Mon 2009-01-19 21:31:54 +0100
message:
  new standalone mkinitrd completion
added:
  to_review/mkinitrd
-------------- next part --------------
=== added file 'to_review/mkinitrd'
--- a/to_review/mkinitrd	1970-01-01 00:00:00 +0000
+++ b/to_review/mkinitrd	2009-01-19 20:31:54 +0000
@@ -0,0 +1,65 @@
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+#
+# bash completion for mkinitrd
+
+have mkinitrd &&
+_mkinitrd()
+{
+	local cur args
+
+	COMPREPLY=()
+	cur=`_get_cword`
+	prev=${COMP_WORDS[COMP_CWORD-1]}
+
+	# --name value style option
+	case "$prev" in
+		--preload)
+			_modules
+			return 0
+			;;
+	esac
+
+	# --name=value style option
+	if [[ "$cur" == *=* ]]; then
+		prev=${cur/=*/}
+		cur=${cur/*=/}
+		case "$prev" in
+			--@(with|builtin))
+				_modules
+				return 0
+				;;
+			--@(fstab|dsdt))
+				_filedir
+				return 0
+				;;
+			--net-dev)
+				_available_interfaces
+				return 0
+				;;
+		esac
+	fi
+
+
+	if [[ "$cur" == -* ]]; then
+		COMPREPLY=( $( compgen -W '--version -v -f --preload \
+			--force-scsi-probe --omit-scsi-modules \
+			--omit-ide-modules --image-version --force-raid-probe \
+			--omit-raid-modules --with= --force-lvm-probe \
+			--omit-lvm-modules --builtin= --omit-dmraid --net-dev= \
+			--fstab= --nocompress --dsdt= --bootchart' -- $cur ) )
+	else
+		_count_args
+
+		case $args in
+			1)
+				_filedir
+				;;
+			2)
+				_kernel_versions
+				;;
+		esac
+	fi
+
+} &&
+complete -F _mkinitrd mkinitrd



More information about the Bash-completion-commits mailing list