Skip to content

Commit

Permalink
completions: added Solidigm plugin to autocomplete scripts
Browse files Browse the repository at this point in the history
Updated both bash and zsh autocomplete scripts
Fixed copy-paste error under ocp section of zsh script

Signed-off-by: Anant Mashiana <[email protected]>
  • Loading branch information
amashiana-sd authored and igaw committed Feb 2, 2024
1 parent 5c3a39c commit c2fc029
Show file tree
Hide file tree
Showing 2 changed files with 298 additions and 2 deletions.
210 changes: 208 additions & 2 deletions completions/_nvme
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ _nvme () {
'nvme-mi-send:send a NVMe-MI send command'
'version:show the program version'
'ocp:OCP cloud SSD extensions'
'solidigm:Solidigm plug-in extensions'
'help:print brief descriptions of all nvme commands'
'json:dump output in json format'
)
Expand Down Expand Up @@ -261,7 +262,188 @@ _nvme () {
-o':alias for --output-file'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme ocp internal-log options" _internal_log
_describe -t commands "nvme ocp telemetry-string-log options" _telemetry_string_log
;;
(*)
_files
;;
esac
;;
(solidigm)
case ${words[2]} in
(id-ctrl)
local _id_ctrl
_id_ctrl=(
--verbose':Increase output verbosity'
-v':alias for --verbose'
--output-format':Output format: normal|json|binary'
-o':alias for --output-format'
--vendor-specific':dump binary vendor field'
-V':alias for --vendor-specific'
--raw-binary':show identify in binary format'
-b':alias for --raw-binary'
--human-readable':show identify in readable format'
-H':alias for --human-readable'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm id-ctrl options" _id_ctrl
;;
(smart-log-add)
local _smart_log_add
_smart_log_add=(
--namespace-id':(optional) desired namespace'
-n':alias for --namespace-id'
--output-format':Output format: normal|json|binary'
-o':alias for --output-format'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm smart-log-add options" _smart_log_add
;;
(vs-smart-add-log)
local _vs_smart_add_log
_vs_smart_add_log=(
--output-format':output Format: normal|json'
-o':alias for --output-format'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm vs-smart-add-log options" _vs_smart_add_log
;;
(vs-internal-log)
local _vs_internal_log
_vs_internal_log=(
--type':Log type: ALL,
CONTROLLERINITTELEMETRY,
HOSTINITTELEMETRY,
HOSTINITTELEMETRYNOGEN, NLOG,
ASSERT, EVENT. Defaults to ALL.'
-t':alias for --type'
--namespace-id':Namespace to get logs from.'
-n':alias for --namespace-id'
--dir-prefix':Output dir prefix; defaults to device serial number.'
-p':alias for --dir-prefix'
--verbose':To print out verbose info.'
-v':alias for --verbose'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm vs-internal-log" _vs_internal_log
;;
(garbage-collect-log)
local _garbage_collect_log
_garbage_collect_log=(
--output-format':Output format: normal|json|binary'
-o':alias for --output-format'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm garbage-collect-log" _garbage_collect_log
;;
(market-log)
local _market_log
_market_log=(
--raw-binary':dump output in binary format'
-b':alias for --raw-binary'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm market-log" _market_log
;;
(latency-tracking-log)
local _latency_tracking_log
_latency_tracking_log=(
--enable':Enable Latency Tracking'
-e':alias for --enable'
--disable':Disable Latency Tracking'
-d':alias for --disable'
--read':Get read statistics'
-r':alias for --read'
--write':Get write statistics'
-w':alias for --write'
--type':Log type to get'
-t':alias for --type'
--output-format':Output format: normal|json|binary'
-o':alias for --output-format'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm latency-tracking-log" _latency_tracking_log
;;
(parse-telemetry-log)
local _parse_telemetry_log
_parse_telemetry_log=(
--host-generate':Controls when to generate new
host initiated report. Default
value '1' generates new host
initiated report, value '0'
causes retrieval of existing
log.'
-g':alias for --host-generate'
--controller-init':Gather report generated by the controller.'
-c':alias for --controller-init'
--data-area':Pick which telemetry data area to
report. Default is 3 to fetch
areas 1-3. Valid options are 1,
2, 3, 4.'
-d':alias for --data-area'
--config-file':JSON configuration file'
-j':alias for --config-file'
--source-file':data source <device> is binary
file containing log dump instead
of block or character device'
-s':alias for --source-file'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm parse-telemetry-log" _parse_telemetry_log
;;
(clear-pcie-correctable-errors)
local _clear_pcie_correctable_errors
_clear_pcie_correctable_errors=(
--no-uuid':Skip UUID index search (UUID index not required for OCP 1.0)'
-n':alias for --no-uuid'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm clear-pcie-correctable-errors" _clear_pcie_correctable_errors
;;
(clear-fw-activate-history)
local _clear_fw_activate_history
_clear_fw_activate_history=(
--no-uuid':Skip UUID index search (UUID index not required for OCP 1.0)'
-n':alias for --no-uuid'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm clear-fw-activate-history" _clear_fw_activate_history
;;
(vs-fw-activate-history)
local _vs_fw_activate_history
_vs_fw_activate_history=(
--output-format':output format : normal | json'
-o':alias for --output-format'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm vs-fw-activate-history" _vs_fw_activate_history
;;
(log-page-directory)
local _log_page_directory
_log_page_directory=(
--output-format':output format : normal | json'
-o':alias for --output-format'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm log-page-directory" _log_page_directory
;;
(temp-stats)
local _temp_stats
_temp_stats=(
--raw-binary':dump output in binary format'
-b':alias for --raw-binary'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm temp-stats" _temp_stats
;;
(vs-drive-info)
local _vs_drive_info
_vs_drive_info=(
--output-format':output format : normal | json'
-o':alias for --output-format'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm vs-drive-info" _vs_drive_info
;;
(*)
_files
Expand Down Expand Up @@ -2077,6 +2259,30 @@ _nvme () {
_arguments '*:: :->subcmds'
_describe -t commands "nvme ocp options" _ocp
;;
(solidigm)
local _solidigm
_solidigm=(
id-ctrl':Send NVMe Identify Controller'
smart-log-add':Retrieve Solidigm SMART Log'
vs-smart-add-log':Get SMART / health extended log (redirects to ocp plug-in)'
vs-internal-log':Retrieve Debug log binaries'
garbage-collect-log':Retrieve Garbage Collection Log'
market-log':Retrieve Market Log'
latency-tracking-log':Enable/Retrieve Latency tracking Log'
parse-telemetry-log':Parse Telemetry Log binary'
clear-pcie-correctable-errors':Clear PCIe Correctable Error Counters (redirects to ocp plug-in)'
clear-fw-activate-history':Clear firmware update history log (redirects to ocp plug-in)'
vs-fw-activate-history':Get firmware activation history log (redirects to ocp plug-in)'
log-page-directory':Retrieve log page directory'
temp-stats':Retrieve Temperature Statistics log'
vs-drive-info':Retrieve drive information'
cloud-SSDplugin-version':Prints plug-in OCP version'
version':Shows the program version'
help':Display this help'
)
_arguments '*:: :->subcmds'
_describe -t commands "nvme solidigm options" _solidigm
;;
(help)
local _h
_h=( id-ctrl id-ns list-ns id-iocs create-ns delete-ns attach-ns detach-ns
Expand All @@ -2094,7 +2300,7 @@ _nvme () {
get-property write-zeroes write-uncor verify sanitize sanitize-log reset
subsystem-reset ns-rescan get-lba-status dsm discover connect-all connect
dim disconnect disconnect-all gen-hostnqn show-hostnqn dir-receive dir-send
virt-mgmt rpmb version ocp
virt-mgmt rpmb version ocp solidigm
)
_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
Expand Down
90 changes: 90 additions & 0 deletions completions/bash-nvme-completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,89 @@ plugin_sfx_opts () {
return 0
}

plugin_solidigm_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
"id-ctrl")
opts+=" --raw-binary -b --human-readable -H \
--vendor-specific -v --output-format= -o \
--verbose -v "
;;
"vs-smart-add-log")
opts+="--output-format= -o"
;;
"garbage-collect-log")
opts+="--output-format= -o"
;;
"vs-internal-log")
opts+=" --type= -t --namespace-id= -n \
--file-prefix= -p --verbose -v"
;;
"latency-tracking-log")
opts+=" --enable -e --disable -d \
--read -r --write -w \
--type -t --output-format -o"
;;
"clear-pcie-correctable-errors")
opts+=" --no-uuid -n"
;;
"parse-telemetry-log")
opts+=" --host-generate -g --controller-init -c \
--data-area -d --config-file -j \
--source-file -s"
;;
"clear-fw-activate-history")
opts+=" --no-uuid -n"
;;
"vs-fw-activate-history")
opts+=" --output-format -o"
;;
"log-page-directory")
opts+=" --output-format -o"
;;
"vs-drive-info")
opts+=" "
;;
"cloud-SSDplugin-version")
opts+=$NO_OPTS
;;
"market-log")
opts+=" --raw-binary -b"
;;
"smart-log-add")
opts+=" --namespace-id= -n --output-format -o"
;;
"temp-stats")
opts+=" --raw-binary -b"
;;
"version")
opts+=$NO_OPTS
;;
"help")
opts+=$NO_OPTS
;;
esac

COMPREPLY+=( $( compgen $compargs -W "$opts" -- $cur ) )

return 0
}

plugin_transcend_opts () {
local opts=""
local compargs=""
Expand Down Expand Up @@ -1417,6 +1500,12 @@ _nvme_subcmds () {
[dera]="smart-log-add"
[sfx]="smart-log-add lat-stats get-bad-block query-cap \
change-cap set-feature get-feature"
[solidigm]="id-ctrl vs-smart-add-log garbage-collect-log \
vs-internal-log latency-tracking-log \
clear-pcie-correctable-errors parse-telemetry-log \
clear-fw-activate-history vs-fw-activate-history log-page-directory \
vs-drive-info cloud-SSDplugin-version market-log \
smart-log-add temp-stats version help"
[transcend]="healthvalue badblock"
[zns]="id-ctrl id-ns zone-mgmt-recv \
zone-mgmt-send report-zones close-zone \
Expand Down Expand Up @@ -1447,6 +1536,7 @@ _nvme_subcmds () {
[shannon]="plugin_shannon_opts"
[dera]="plugin_dera_opts"
[sfx]="plugin_sfx_opts"
[solidigm]="plugin_solidigm_opts"
[transcend]="plugin_transcend_opts"
[zns]="plugin_zns_opts"
[nvidia]="plugin_nvidia_opts"
Expand Down

0 comments on commit c2fc029

Please sign in to comment.