]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
completions: Add ocp commands bash completion
authorTokunori Ikegami <ikegami.t@gmail.com>
Sat, 13 May 2023 03:33:33 +0000 (12:33 +0900)
committerDaniel Wagner <wagi@monom.org>
Mon, 15 May 2023 15:07:58 +0000 (17:07 +0200)
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
completions/bash-nvme-completion.sh

index a16036ee9af1b45f1130ad3484286a339378d825..bafbcdc81339d3028b84fc9381176904154d2540 100644 (file)
@@ -1296,6 +1296,65 @@ 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"
+                       ;;
+               "help")
+               opts+=$NO_OPTS
+                       ;;
+       esac
+
+       COMPREPLY+=( $( compgen $compargs -W "$opts" -- $cur ) )
+
+       return 0
+}
+
 _nvme_subcmds () {
        local cur prev words cword
        _init_completion || return
@@ -1350,6 +1409,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"
        )
 
        # Associative array mapping plugins to coresponding option completions
@@ -1371,6 +1435,7 @@ _nvme_subcmds () {
                [nvidia]="plugin_nvidia_opts"
                [ymtc]="plugin_ymtc_opts"
                [inspur]="plugin_inspur_opts"
+               [ocp]="plugin_ocp_opts"
        )
 
        # Top level commands