diff mbox

[ndctl,v2,4/4] ndctl, bash-completion: Add bash completion for inject-smart

Message ID 20180209053500.6871-4-vishal.l.verma@intel.com (mailing list archive)
State Accepted
Commit 9072509a1f18
Headers show

Commit Message

Verma, Vishal L Feb. 9, 2018, 5:35 a.m. UTC
This adds bash completion for the enw ndctl inject-smart command.
non-option arguments are completed with dimms, and new options
requiring data are marked as such.

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 contrib/ndctl | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/contrib/ndctl b/contrib/ndctl
index eeda1c4..89e0252 100755
--- a/contrib/ndctl
+++ b/contrib/ndctl
@@ -91,7 +91,7 @@  __ndctlcomp()
 
 	COMPREPLY=( $( compgen -W "$1" -- "$2" ) )
 	for cword in "${COMPREPLY[@]}"; do
-		if [[ "$cword" == @(--bus|--region|--type|--mode|--size|--dimm|--reconfig|--uuid|--name|--sector-size|--map|--namespace|--input|--output|--label-version|--align|--block|--count|--firmware) ]]; then
+		if [[ "$cword" == @(--bus|--region|--type|--mode|--size|--dimm|--reconfig|--uuid|--name|--sector-size|--map|--namespace|--input|--output|--label-version|--align|--block|--count|--firmware|--media-temperature|--ctrl-temperature|--spares|--media-temperature-threshold|--ctrl-temperature-threshold|--spares-threshold|--media-temperature-alarm|--ctrl-temperature-alarm|--spares-alarm) ]]; then
 			COMPREPLY[$i]="${cword}="
 		else
 			COMPREPLY[$i]="${cword} "
@@ -210,6 +210,13 @@  __ndctl_comp_options()
 		--label-version)
 			opts="1.1 1.2"
 			;;
+		--media-temperature-alarm)
+			;&
+		--ctrl-temperature-alarm)
+			;&
+		--spares-alarm)
+			opts="on off"
+			;;
 		*)
 			return
 			;;
@@ -262,6 +269,9 @@  __ndctl_comp_non_option_args()
 	inject-error)
 		opts="$(__ndctl_get_ns -i)"
 		;;
+	inject-smart)
+		opts="$(__ndctl_get_dimms -i)"
+		;;
 	*)
 		return
 		;;