Add bash completion helpers for the new daxctl-reconfigure-device
command.

Cc: Dan Williams <dan.j.willi...@intel.com>
Signed-off-by: Vishal Verma <vishal.l.ve...@intel.com>
---
 contrib/ndctl | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/contrib/ndctl b/contrib/ndctl
index d1f8bd6..32c4731 100755
--- a/contrib/ndctl
+++ b/contrib/ndctl
@@ -544,7 +544,7 @@ __daxctlcomp()
 
        COMPREPLY=( $( compgen -W "$1" -- "$2" ) )
        for cword in "${COMPREPLY[@]}"; do
-               if [[ "$cword" == @(--region|--dev) ]]; then
+               if [[ "$cword" == @(--region|--dev|--mode) ]]; then
                        COMPREPLY[$i]="${cword}="
                else
                        COMPREPLY[$i]="${cword} "
@@ -569,6 +569,9 @@ __daxctl_comp_options()
                --dev)
                        opts="$(__daxctl_get_devs -i)"
                        ;;
+               --mode)
+                       opts="system-ram devdax"
+                       ;;
                *)
                        return
                        ;;
@@ -579,8 +582,19 @@ __daxctl_comp_options()
 
 __daxctl_comp_non_option_args()
 {
-       # there aren't any commands that accept non option arguments yet
-       return
+       local subcmd=$1
+       local cur=$2
+       local opts
+
+       case $subcmd in
+       reconfigure-device)
+               opts="$(__daxctl_get_devs -i) all"
+               ;;
+       *)
+               return
+               ;;
+       esac
+       __daxctlcomp "$opts" "$cur"
 }
 
 __daxctl_main()
-- 
2.20.1

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to