Skip to content

Commit 3e512dd

Browse files
lgdacunhigaw
authored andcommitted
completions: Added fdp feature auto-completion.
Fixed syntax error on zsh auto-completion Signed-off-by: Leonardo da Cunha <[email protected]>
1 parent a4c3dbc commit 3e512dd

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

completions/_nvme

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ _nvme () {
118118
'version:show the program version'
119119
'ocp:OCP cloud SSD extensions'
120120
'solidigm:Solidigm plug-in extensions'
121+
'fdp:FDP plug-in extensions'
121122
'micron:Micron plug-in extensions'
122123
'dapustor:DapuStor plug-in extensions'
123124
'help:print brief descriptions of all nvme commands'
@@ -603,6 +604,28 @@ _nvme () {
603604
;;
604605
esac
605606
;;
607+
(fdp)
608+
case ${words[2]} in
609+
(feature)
610+
local _feature
611+
_feature=(
612+
--endgrp-id=':Endurance group ID'
613+
-e':alias for --endgrp-id'
614+
--enable-conf-idx=':FDP configuration index to enable'
615+
-c':alias for --enable-conf-idx'
616+
--disable=':Disable current FDP configuration'
617+
-d':alias for --disable'
618+
--verbose=':Increase output verbosity'
619+
-v':alias for --verbose'
620+
)
621+
_arguments '*:: :->subcmds'
622+
_describe -t commands "nvme fdp feature options" _feature
623+
;;
624+
(*)
625+
_files
626+
;;
627+
esac
628+
;;
606629
(dapustor)
607630
case ${words[2]} in
608631
(smart-log-add)
@@ -2643,7 +2666,10 @@ _nvme () {
26432666
-v':alias for --verbose'
26442667
--output-format=':Output format: normal|json|binary'
26452668
-o ':alias for --output-format'
2669+
)
2670+
_arguments '*:: :->subcmds'
26462671
_describe -t commands "nvme rotational-media-info-log" _rmi_log
2672+
;;
26472673
(changed-alloc-ns-list-log)
26482674
local _changed_alloc_ns_list_log
26492675
_changed_alloc_ns_list_log=(
@@ -2768,6 +2794,16 @@ _nvme () {
27682794
_arguments '*:: :->subcmds'
27692795
_describe -t commands "nvme solidigm options" _solidigm
27702796
;;
2797+
(fdp)
2798+
local _fdp
2799+
_fdp=(
2800+
feature':Show, enable or disable FDP configuration'
2801+
version':Shows the plug-in version'
2802+
help':Display this help'
2803+
)
2804+
_arguments '*:: :->subcmds'
2805+
_describe -t commands "nvme fdp options" _fdp
2806+
;;
27712807
(micron)
27722808
local micron
27732809
_micron=(
@@ -2824,7 +2860,7 @@ _nvme () {
28242860
subsystem-reset ns-rescan get-lba-status dsm discover connect-all connect
28252861
dim disconnect disconnect-all gen-hostnqn show-hostnqn tls-key dir-receive
28262862
dir-send virt-mgmt rpmb version ocp solidigm dapustor mgmt-addr-list-log
2827-
rotational-media-info-log changed-alloc-ns-list-log
2863+
rotational-media-info-log changed-alloc-ns-list-log fdp
28282864
)
28292865
_arguments '*:: :->subcmds'
28302866
_describe -t commands "help: infos on a specific nvme command, or provide no option to see a synopsis of all nvme commands" _h

completions/bash-nvme-completion.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,41 @@ plugin_solidigm_opts () {
12361236
return 0
12371237
}
12381238

1239+
plugin_fdp_opts () {
1240+
local opts=""
1241+
local compargs=""
1242+
1243+
local nonopt_args=0
1244+
for (( i=0; i < ${#words[@]}-1; i++ )); do
1245+
if [[ ${words[i]} != -* ]]; then
1246+
let nonopt_args+=1
1247+
fi
1248+
done
1249+
1250+
if [ $nonopt_args -eq 3 ]; then
1251+
opts="/dev/nvme* "
1252+
fi
1253+
1254+
opts+=" "
1255+
1256+
case "$1" in
1257+
"feature")
1258+
opts+=" --endgrp-id= -e --enable-conf-idx= -c \
1259+
--disable -d --verbose -v"
1260+
;;
1261+
"version")
1262+
opts+=$NO_OPTS
1263+
;;
1264+
"help")
1265+
opts+=$NO_OPTS
1266+
;;
1267+
esac
1268+
1269+
COMPREPLY+=( $( compgen $compargs -W "$opts" -- $cur ) )
1270+
1271+
return 0
1272+
}
1273+
12391274
plugin_transcend_opts () {
12401275
local opts=""
12411276
local compargs=""
@@ -1631,6 +1666,7 @@ _nvme_subcmds () {
16311666
clear-fw-activate-history vs-fw-activate-history log-page-directory \
16321667
vs-drive-info cloud-SSDplugin-version market-log \
16331668
smart-log-add temp-stats workload-tracker version help"
1669+
[fdp]="feature version help"
16341670
[transcend]="healthvalue badblock"
16351671
[dapustor]="smart-log-add"
16361672
[zns]="id-ctrl id-ns zone-mgmt-recv \
@@ -1667,6 +1703,7 @@ _nvme_subcmds () {
16671703
[dera]="plugin_dera_opts"
16681704
[sfx]="plugin_sfx_opts"
16691705
[solidigm]="plugin_solidigm_opts"
1706+
[fdp]="plugin_fdp_opts"
16701707
[transcend]="plugin_transcend_opts"
16711708
[dapustor]="plugin_dapustor_opts"
16721709
[zns]="plugin_zns_opts"

0 commit comments

Comments
 (0)