diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-30 22:38:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-30 22:38:48 +0000 |
commit | 01c4d3d32c5044d3d17055c2d94d40fee9d130e1 (patch) | |
tree | 2c213cd5436bff644fa7023b94674a9c12d2e1af /completions/bash-nvme-completion.sh | |
parent | Adding upstream version 2.4+really2.4. (diff) | |
download | nvme-cli-01c4d3d32c5044d3d17055c2d94d40fee9d130e1.tar.xz nvme-cli-01c4d3d32c5044d3d17055c2d94d40fee9d130e1.zip |
Adding upstream version 2.5.upstream/2.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | completions/bash-nvme-completion.sh | 114 |
1 files changed, 106 insertions, 8 deletions
diff --git a/completions/bash-nvme-completion.sh b/completions/bash-nvme-completion.sh index fae3ab4..8f451ff 100644 --- a/completions/bash-nvme-completion.sh +++ b/completions/bash-nvme-completion.sh @@ -5,8 +5,11 @@ # Kelly Kaoudis kelly.n.kaoudis at intel.com, Aug. 2015 nvme_list_opts () { - local opts="" + local opts="" local compargs="" + local vals="" + local opt="" + local val="" local nonopt_args=0 for (( i=0; i < ${#words[@]}-1; i++ )); do @@ -20,6 +23,19 @@ nvme_list_opts () { fi opts+=" " + vals+=" " + + if [[ $cur != -* ]] && [[ $cur != "" ]] && [[ $prev == "=" ]] && [[ ${words[$cword-2]} == --* ]]; then + opt+="${words[$cword-2]}" + val+="$cur" + elif [[ $cur == "" ]] && [[ $prev != "=" ]] || [[ $cur == "=" ]] && [[ $prev == --* ]]; then + opt+="$prev" + elif [[ $cur != "=" ]] && [[ $prev != --* ]] && [[ $prev != "=" ]]; then + opt+="$prev" + val+="$cur" + else + opt+="$cur" + fi # Listed here in the same order as in nvme-builtin.h case "$1" in @@ -88,13 +104,17 @@ nvme_list_opts () { opts+=" --endgrp-id= -i --output-format= -o" ;; "id-iocs") - opts+=" --controller-id= -c --output-format= -o --human-readable -H" + opts+=" --controller-id= -c" + ;; + "id-domain") + opts+=" --domain-id= -c --output-format= -o" ;; "create-ns") opts+=" --nsze= -s --ncap= -c --flbas= -f \ --dps= -d --nmic= -m --anagrp-id= -a --nvmset-id= -i \ --block-size= -b --timeout= -t --csi= -y --lbstm= -l \ - --nsze-si= -S --ncap-si= -C" + --nphndls= -n --nsze-si= -S --ncap-si= -C --azr -z --rar= -r \ + --ror= -o --rnumzrwa= -u --phndls= -p" ;; "delete-ns") opts+=" -namespace-id= -n --timeout= -t" @@ -318,11 +338,12 @@ nvme_list_opts () { --block-count= -c --deac -d --limited-retry -l \ --force-unit-access -f --prinfo= -p --ref-tag= -r \ --app-tag-mask= -m --app-tag= -a \ - --storage-tag= -S --storage-tag-check -C" + --storage-tag= -S --storage-tag-check -C \ + --dir-type= -T --dir-spec= -S" ;; "write-uncor") opts+=" --namespace-id= -n --start-block= -s \ - --block-count= -c" + --block-count= -c --dir-type= -T --dir-spec= -S" ;; "verify") opts+=" --namespace-id= -n --start-block= -s \ @@ -334,6 +355,11 @@ nvme_list_opts () { "sanitize") opts+=" --no-dealloc -d --oipbp -i --owpass= -n \ --ause -u --sanact= -a --ovrpat= -p" + case $opt in + --sanact|-a) + vals+=" exit-failure start-block-erase start-overwrite start-crypto-erase" + ;; + esac ;; "sanitize-log") opts+=" --rae -r --output-format= -o --human-readable -H \ @@ -428,9 +454,13 @@ nvme_list_opts () { ;; esac - opts+=" -h --help" + opts+=" -h --help -j --json" - COMPREPLY+=( $( compgen $compargs -W "$opts" -- $cur ) ) + if [[ $vals == " " ]]; then + COMPREPLY+=( $( compgen $compargs -W "$opts" -- $cur ) ) + else + COMPREPLY+=( $( compgen $compargs -W "$vals" -- $val ) ) + fi return 0 } @@ -1266,6 +1296,68 @@ plugin_inspur_opts () { return 0 } +plugin_ocp_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 + "smart-add-log") + opts+=" --output-format= -o" + ;; + "latency-monitor-log") + opts+=" --output-format= -o" + ;; + "set-latency-monitor-feature") + opts+=" --active_bucket_timer_threshold= -t \ + --active_threshold_a= -a --active_threshold_b= -b \ + --active_threshold_c= -c --active_threshold_d= -d \ + --active_latency_config= -f \ + --active_latency_minimum_window= -w \ + --debug_log_trigger_enable -r --discard_debug_log= -l \ + --latency_monitor_feature_enable= -e" + ;; + "internal-log") + opts+=" --telemetry_type= -t --telemetry_data_area= -a \ + --output-file= -o" + ;; + "clear-fw-activate-history") + opts+=" --no-uuid -n" + ;; + "eol-plp-failure-mode") + opts+=" --mode= -m --save -s --sel= -S --no-uuid -n" + ;; + "clear-pcie-correctable-error-counters") + opts+=" --no-uuid -n" + ;; + "vs-fw-activate-history") + opts+=" --output-format= -o" + ;; + "device-capability-log") + opts+=" --output-format= -o" + ;; + "help") + opts+=$NO_OPTS + ;; + esac + + COMPREPLY+=( $( compgen $compargs -W "$opts" -- $cur ) ) + + return 0 +} + _nvme_subcmds () { local cur prev words cword _init_completion || return @@ -1320,6 +1412,11 @@ _nvme_subcmds () { [nvidia]="id-ctrl" [ymtc]="smart-log-add" [inspur]="nvme-vendor-log" + [ocp]="smart-add-log latency-monitor-log \ + set-latency-monitor-feature internal-log \ + clear-fw-activate-history eol-plp-failure-mode \ + clear-pcie-correctable-error-counters \ + vs-fw-activate-history device-capability-log" ) # Associative array mapping plugins to coresponding option completions @@ -1341,6 +1438,7 @@ _nvme_subcmds () { [nvidia]="plugin_nvidia_opts" [ymtc]="plugin_ymtc_opts" [inspur]="plugin_inspur_opts" + [ocp]="plugin_ocp_opts" ) # Top level commands @@ -1348,7 +1446,7 @@ _nvme_subcmds () { 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 \ + ns-descs id-nvmset id-uuid id-iocs id-domain 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 \ |