]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
completions: Added fdp feature auto-completion.
authorLeonardo da Cunha <leonardo.da.cunha@solidigm.com>
Wed, 19 Feb 2025 22:37:34 +0000 (14:37 -0800)
committerDaniel Wagner <wagi@monom.org>
Thu, 20 Feb 2025 07:41:05 +0000 (08:41 +0100)
Fixed syntax error on zsh auto-completion

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
completions/_nvme
completions/bash-nvme-completion.sh

index 324b070e07708a602398e7378972fceb73d38bf6..605e4522c97a5297af345b7d20fc7abbd72ccd3d 100644 (file)
@@ -118,6 +118,7 @@ _nvme () {
        'version:show the program version'
        'ocp:OCP cloud SSD extensions'
        'solidigm:Solidigm plug-in extensions'
+       'fdp:FDP plug-in extensions'
        'micron:Micron plug-in extensions'
        'dapustor:DapuStor plug-in extensions'
        'help:print brief descriptions of all nvme commands'
@@ -603,6 +604,28 @@ _nvme () {
                                ;;
                        esac
                        ;;
+               (fdp)
+                       case ${words[2]} in
+                       (feature)
+                               local _feature
+                               _feature=(
+                               --endgrp-id=':Endurance group ID'
+                               -e':alias for --endgrp-id'
+                               --enable-conf-idx=':FDP configuration index to enable'
+                               -c':alias for --enable-conf-idx'
+                               --disable=':Disable current FDP configuration'
+                               -d':alias for --disable'
+                               --verbose=':Increase output verbosity'
+                               -v':alias for --verbose'
+                               )
+                               _arguments '*:: :->subcmds'
+                               _describe -t commands "nvme fdp feature options" _feature
+                               ;;
+                       (*)
+                               _files
+                               ;;
+                       esac
+                       ;;
                (dapustor)
                        case ${words[2]} in
                        (smart-log-add)
@@ -2643,7 +2666,10 @@ _nvme () {
                        -v':alias for --verbose'
                        --output-format=':Output format: normal|json|binary'
                        -o ':alias for --output-format'
+                       )
+                       _arguments '*:: :->subcmds'
                        _describe -t commands "nvme rotational-media-info-log" _rmi_log
+                       ;;
                (changed-alloc-ns-list-log)
                        local _changed_alloc_ns_list_log
                        _changed_alloc_ns_list_log=(
@@ -2768,6 +2794,16 @@ _nvme () {
                        _arguments '*:: :->subcmds'
                        _describe -t commands "nvme solidigm options" _solidigm
                        ;;
+               (fdp)
+                       local _fdp
+                       _fdp=(
+                       feature':Show, enable or disable FDP configuration'
+                       version':Shows the plug-in version'
+                       help':Display this help'
+                       )
+                       _arguments '*:: :->subcmds'
+                       _describe -t commands "nvme fdp options" _fdp
+                       ;;
                (micron)
                        local micron
                        _micron=(
@@ -2824,7 +2860,7 @@ _nvme () {
                        subsystem-reset ns-rescan get-lba-status dsm discover connect-all connect
                        dim disconnect disconnect-all gen-hostnqn show-hostnqn tls-key dir-receive
                        dir-send virt-mgmt rpmb version ocp solidigm dapustor mgmt-addr-list-log
-                       rotational-media-info-log changed-alloc-ns-list-log
+                       rotational-media-info-log changed-alloc-ns-list-log fdp
                        )
                        _arguments '*:: :->subcmds'
                        _describe -t commands "help: infos on a specific nvme command, or provide no option to see a synopsis of all nvme commands" _h
index 949f4da506c3444fe394ea1b8eca33f8697a393f..c2045a7c4583eb4f151239f2c6ccf116784c6b14 100644 (file)
@@ -1236,6 +1236,41 @@ plugin_solidigm_opts () {
        return 0
 }
 
+plugin_fdp_opts () {
+       local opts=""
+       local compargs=""
+
+       local nonopt_args=0
+       for (( i=0; i < ${#words[@]}-1; i++ )); do
+               if [[ ${words[i]} != -* ]]; then
+                       let nonopt_args+=1
+               fi
+       done
+
+       if [ $nonopt_args -eq 3 ]; then
+               opts="/dev/nvme* "
+       fi
+
+       opts+=" "
+
+       case "$1" in
+               "feature")
+               opts+=" --endgrp-id= -e --enable-conf-idx= -c \
+               --disable -d --verbose -v"
+                       ;;
+               "version")
+               opts+=$NO_OPTS
+                       ;;
+               "help")
+               opts+=$NO_OPTS
+                       ;;
+       esac
+
+       COMPREPLY+=( $( compgen $compargs -W "$opts" -- $cur ) )
+
+       return 0
+}
+
 plugin_transcend_opts () {
        local opts=""
        local compargs=""
@@ -1631,6 +1666,7 @@ _nvme_subcmds () {
                        clear-fw-activate-history vs-fw-activate-history log-page-directory \
                        vs-drive-info cloud-SSDplugin-version market-log \
                        smart-log-add temp-stats workload-tracker version help"
+               [fdp]="feature version help"
                [transcend]="healthvalue badblock"
                [dapustor]="smart-log-add"
                [zns]="id-ctrl id-ns zone-mgmt-recv \
@@ -1667,6 +1703,7 @@ _nvme_subcmds () {
                [dera]="plugin_dera_opts"
                [sfx]="plugin_sfx_opts"
                [solidigm]="plugin_solidigm_opts"
+               [fdp]="plugin_fdp_opts"
                [transcend]="plugin_transcend_opts"
                [dapustor]="plugin_dapustor_opts"
                [zns]="plugin_zns_opts"