summaryrefslogtreecommitdiffstats
path: root/completions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-31 04:13:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-31 04:13:03 +0000
commitd2082ee94267e4ca59b187c5e37dac03c1d65187 (patch)
treecd93a882e0726a7df500fedf2263263984406b36 /completions
parentReleasing debian version 2.2.1-4. (diff)
downloadnvme-cli-d2082ee94267e4ca59b187c5e37dac03c1d65187.tar.xz
nvme-cli-d2082ee94267e4ca59b187c5e37dac03c1d65187.zip
Merging upstream version 2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions')
-rw-r--r--completions/_nvme3
-rw-r--r--completions/bash-nvme-completion.sh248
2 files changed, 140 insertions, 111 deletions
diff --git a/completions/_nvme b/completions/_nvme
index 16c9b7c..5910898 100644
--- a/completions/_nvme
+++ b/completions/_nvme
@@ -1,6 +1,5 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
#compdef _nvme nvme
+# SPDX-License-Identifier: GPL-2.0-or-later
# zsh completions for the nvme command-line interface,
# very loosely based on git and adb command completion
diff --git a/completions/bash-nvme-completion.sh b/completions/bash-nvme-completion.sh
index f067940..c5fbda0 100644
--- a/completions/bash-nvme-completion.sh
+++ b/completions/bash-nvme-completion.sh
@@ -4,114 +4,6 @@
# (unfortunately, bash won't let me add descriptions to cmds)
# Kelly Kaoudis kelly.n.kaoudis at intel.com, Aug. 2015
-# Constant to indicate command has no options
-NO_OPTS=""
-readonly NO_OPTS
-
-# Associative array of plugins and associated subcommands
-# Order here is same as PLUGIN_OBJS in Makefile
-typeset -Ar _plugin_subcmds=(
- [intel]="id-ctrl internal-log lat-stats \
- set-bucket-thresholds lat-stats-tracking \
- market-name smart-log-add temp-stats"
- [amzn]="id-ctrl"
- [memblaze]="smart-log-add get-pm-status set-pm-status \
- select-download lat-stats lat-stats-print lat-log \
- lat-log-print clear-error-log"
- [wdc]="cap-diag drive-log get-crash-dump get-pfail-dump \
- id-ctrl purge purge-monitor vs-internal-log \
- vs-nand-stats vs-smart-add-log clear-pcie-correctable-errors \
- drive-essentials get-drive-status clear-assert-dump \
- drive-resize vs-fw-activate-history clear-fw-activate-history \
- enc-get-log vs-telemetry-controller-option \
- vs-error-reason-identifier log-page-directory \
- namespace-resize vs-drive-info vs-temperature-stats \
- capabilities cloud-SSD-plugin-version vs-pcie-stats"
- [huawei]="list id-ctrl"
- [netapp]="smdevices ontapdevices"
- [toshiba]="vs-smart-add-log vs-internal-log \
- clear-pcie-correctable-errors"
- [micron]="select-download vs-temperature-stats vs-pcie-stats \
- clear-pcie-correctable-errors vs-internal-log \
- vs-telemetry-controller-option vs-nand-stats \
- vs-drive-info plugin-version cloud-SSD-plugin-version \
- log-page-directory vs-fw-activate-history \
- vs-error-reason-identifier vs-smart-add-log \
- clear-fw-activate-history vs-smbus-option"
- [seagate]="vs-temperature-stats vs-log-page-sup \
- vs-smart-add-log vs-pcie-stats clear-pcie-correctable-errors \
- get-host-tele get-ctrl-tele vs-internal-log \
- plugin-version"
- [virtium]="save-smart-to-vtview-log show-identify"
- [shannon]="smart-log-add get-feature-add set-feature-add id-ctrl"
- [dera]="smart-log-add"
- [sfx]="smart-log-add lat-stats get-bad-block query-cap \
- change-cap set-feature get-feature"
- [transcend]="healthvalue badblock"
- [zns]="id-ctrl id-ns zone-mgmt-recv \
- zone-mgmt-send report-zones close-zone \
- finish-zone open-zone reset-zone offline-zone \
- set-zone-desc zone-append changed-zone-list"
- [nvidia]="id-ctrl"
- [ymtc]="smart-log-add"
-)
-readonly _plugin_subcmds
-
-# Associative array mapping plugins to coresponding option completions
-typeset -Ar _plugin_funcs=(
- [intel]="plugin_intel_opts"
- [amzn]="plugin_amzn_opts"
- [memblaze]="plugin_memblaze_opts"
- [wdc]="plugin_wdc_opts"
- [huawei]="plugin_huawei_opts"
- [toshiba]="plugin_toshiba_opts"
- [micron]="plugin_micron_opts"
- [seagate]="plugin_seagate_opts"
- [virtium]="plugin_virtium_opts"
- [shannon]="plugin_shannon_opts"
- [dera]="plugin_dera_opts"
- [sfx]="pluginx_sfx_opts"
- [transcend]="plugin_transcend_opts"
- [zns]="plugin_zns_opts"
- [nvidia]="plugin_nvidia_opts"
- [ymtc]="plugin_ymtc_opts"
-)
-readonly _plugin_funcs
-
-# Top level commands
-_cmds="list list-subsys id-ctrl id-ns \
- id-ns-granularity list-ns list-ctrl \
- id-ns-lba-format nvm-id-ns nvm-id-ns-lba-format \
- nvm-id-ctrl primary-ctrl-caps list-secondary \
- ns-descs id-nvmset id-uuid id-iocs create-ns \
- delete-ns get-ns-id get-log telemetry-log \
- fw-log changed-ns-list-log smart-log ana-log \
- error-log effects-log endurance-log \
- predictable-lat-log pred-lat-event-agg-log \
- persistent-event-log endurance-agg-log \
- lba-status-log resv-notif-log get-feature \
- device-self-test self-test-log set-feature \
- set-property get-property format fw-commit \
- fw-download admin-passthru io-passthru \
- security-send security-recv get-lba-status \
- resv-acquire resv-register resv-release \
- resv-report dsm copy flush compare read \
- write write-zeros write-uncor verify \
- sanitize sanitize-log reset subsystem-reset \
- ns-rescan show-regs discover connect-all \
- connect disconnect disconnect-all gen-hostnqn \
- show-hostnqn dir-receive dir-send virt-mgmt \
- rpmb boot-part-log fid-support-effects-log \
- supported-log-pages lockdown media-unit-stat-log \
- supported-cap-config-log dim show-topology"
-
-# Add plugins:
-for plugin in "${!_plugin_subcmds[@]}"; do
- _cmds+=" $plugin"
-done
-
-cmds+=" version help"
-
nvme_list_opts () {
local opts=""
local compargs=""
@@ -1333,7 +1225,38 @@ plugin_ymtc_opts () {
opts+=" --namespace-id= -n --raw-binary -b"
;;
"help")
- opts+=NO_OPTS
+ opts+=$NO_OPTS
+ ;;
+ esac
+
+ COMPREPLY+=( $( compgen $compargs -W "$opts" -- $cur ) )
+
+ return 0
+}
+
+plugin_inspur_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
+ "nvme-vendor-log")
+ opts+=$NO_OPTS
+ ;;
+ "help")
+ opts+=$NO_OPTS
;;
esac
@@ -1346,6 +1269,113 @@ _nvme_subcmds () {
local cur prev words cword
_init_completion || return
+ # Constant to indicate command has no options
+ NO_OPTS=""
+
+ # Associative array of plugins and associated subcommands
+ # Order here is same as PLUGIN_OBJS in Makefile
+ typeset -Ar _plugin_subcmds=(
+ [intel]="id-ctrl internal-log lat-stats \
+ set-bucket-thresholds lat-stats-tracking \
+ market-name smart-log-add temp-stats"
+ [amzn]="id-ctrl"
+ [memblaze]="smart-log-add get-pm-status set-pm-status \
+ select-download lat-stats lat-stats-print lat-log \
+ lat-log-print clear-error-log"
+ [wdc]="cap-diag drive-log get-crash-dump get-pfail-dump \
+ id-ctrl purge purge-monitor vs-internal-log \
+ vs-nand-stats vs-smart-add-log clear-pcie-correctable-errors \
+ drive-essentials get-drive-status clear-assert-dump \
+ drive-resize vs-fw-activate-history clear-fw-activate-history \
+ enc-get-log vs-telemetry-controller-option \
+ vs-error-reason-identifier log-page-directory \
+ namespace-resize vs-drive-info vs-temperature-stats \
+ capabilities cloud-SSD-plugin-version vs-pcie-stats"
+ [huawei]="list id-ctrl"
+ [netapp]="smdevices ontapdevices"
+ [toshiba]="vs-smart-add-log vs-internal-log \
+ clear-pcie-correctable-errors"
+ [micron]="select-download vs-temperature-stats vs-pcie-stats \
+ clear-pcie-correctable-errors vs-internal-log \
+ vs-telemetry-controller-option vs-nand-stats \
+ vs-drive-info plugin-version cloud-SSD-plugin-version \
+ log-page-directory vs-fw-activate-history \
+ vs-error-reason-identifier vs-smart-add-log \
+ clear-fw-activate-history vs-smbus-option"
+ [seagate]="vs-temperature-stats vs-log-page-sup \
+ vs-smart-add-log vs-pcie-stats clear-pcie-correctable-errors \
+ get-host-tele get-ctrl-tele vs-internal-log \
+ plugin-version"
+ [virtium]="save-smart-to-vtview-log show-identify"
+ [shannon]="smart-log-add get-feature-add set-feature-add id-ctrl"
+ [dera]="smart-log-add"
+ [sfx]="smart-log-add lat-stats get-bad-block query-cap \
+ change-cap set-feature get-feature"
+ [transcend]="healthvalue badblock"
+ [zns]="id-ctrl id-ns zone-mgmt-recv \
+ zone-mgmt-send report-zones close-zone \
+ finish-zone open-zone reset-zone offline-zone \
+ set-zone-desc zone-append changed-zone-list"
+ [nvidia]="id-ctrl"
+ [ymtc]="smart-log-add"
+ [inspur]="nvme-vendor-log"
+ )
+
+ # Associative array mapping plugins to coresponding option completions
+ typeset -Ar _plugin_funcs=(
+ [intel]="plugin_intel_opts"
+ [amzn]="plugin_amzn_opts"
+ [memblaze]="plugin_memblaze_opts"
+ [wdc]="plugin_wdc_opts"
+ [huawei]="plugin_huawei_opts"
+ [toshiba]="plugin_toshiba_opts"
+ [micron]="plugin_micron_opts"
+ [seagate]="plugin_seagate_opts"
+ [virtium]="plugin_virtium_opts"
+ [shannon]="plugin_shannon_opts"
+ [dera]="plugin_dera_opts"
+ [sfx]="plugin_sfx_opts"
+ [transcend]="plugin_transcend_opts"
+ [zns]="plugin_zns_opts"
+ [nvidia]="plugin_nvidia_opts"
+ [ymtc]="plugin_ymtc_opts"
+ [inspur]="plugin_inspur_opts"
+ )
+
+ # Top level commands
+ _cmds="list list-subsys id-ctrl id-ns \
+ id-ns-granularity list-ns list-ctrl \
+ id-ns-lba-format nvm-id-ns nvm-id-ns-lba-format \
+ nvm-id-ctrl primary-ctrl-caps list-secondary \
+ ns-descs id-nvmset id-uuid id-iocs create-ns \
+ delete-ns get-ns-id get-log telemetry-log \
+ fw-log changed-ns-list-log smart-log ana-log \
+ error-log effects-log endurance-log \
+ predictable-lat-log pred-lat-event-agg-log \
+ persistent-event-log endurance-agg-log \
+ lba-status-log resv-notif-log get-feature \
+ device-self-test self-test-log set-feature \
+ set-property get-property format fw-commit \
+ fw-download admin-passthru io-passthru \
+ security-send security-recv get-lba-status \
+ resv-acquire resv-register resv-release \
+ resv-report dsm copy flush compare read \
+ write write-zeros write-uncor verify \
+ sanitize sanitize-log reset subsystem-reset \
+ ns-rescan show-regs discover connect-all \
+ connect disconnect disconnect-all gen-hostnqn \
+ show-hostnqn dir-receive dir-send virt-mgmt \
+ rpmb boot-part-log fid-support-effects-log \
+ supported-log-pages lockdown media-unit-stat-log \
+ supported-cap-config-log dim show-topology list-endgrp"
+
+ # Add plugins:
+ for plugin in "${!_plugin_subcmds[@]}"; do
+ _cmds+=" $plugin"
+ done
+
+ cmds+=" version help"
+
if [[ ${#words[*]} -lt 3 ]]; then
COMPREPLY+=( $(compgen -W "$_cmds" -- $cur ) )
else