0
  #   ˆl–ßi~”Ji?u6 ¸Ë—
˜´o¿„hO2÷ÁÃ ?÷     # SPDX-License-Identifier: GPL-2.0-or-later
#
# bash tab completion for the nvme command line utility
# (unfortunately, bash won't let me add descriptions to cmds)
# Kelly Kaoudis kelly.n.kaoudis at intel.com, Aug. 2015

nvme_list_opts () {
	local opts=""
	local compargs=""
	local vals=""
	local opt=""
	local val=""

	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 2 ]; then
		opts="/dev/nvme* "
	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
		"list")
		opts+=$NO_OPTS
			;;
		"list-subsys")
		opts=+=" --output-format= -o --verbose -v"
			;;
		"id-ctrl")
		opts+=" --raw-binary -b --human-readable -H \
			--vendor-specific -V --output-format= -o"
			;;
		"id-ns")
		opts+=" --namespace-id= -n --raw-binary -b \
			--human-readable -H --vendor-specific -V \
			--force -f --output-format= -o"
			;;
		"id-ns-granularity")
		opts+=" --output-format= -o"
			;;
		"id-ns-lba-format")
		opts+=" --lba-format-index= -i --uuid-index= -U \
			--verbose -v --output-format= -o"
			;;
		"list-ns")
		opts+=" --namespace-id= -n --al -a --csi= -y \
			--outputformat= -o --timeout= -t"
			;;
		"list-ctrl")
		opts+=" --namespace-id= -n --cntid= -c \
			--output-format= -o"
			;;
		"cmdset-ind-id-ns")
		opts+=" --namespace-id= -n --raw-binary -b \
			--human-readable -H --output-format= -o"
			;;
		"nvm-id-ctrl")
		opts+=" --output-format= -o"
			;;
		"nvm-id-ns")
		opts+=" --namespace-id= -n --uuid-index= -U\
			--verbose -v --output-format= -o"
			;;
		"nvm-id-ns-lba-format")
		opts+=" --lba-format-index= -i --uuid-index= -U \
			--verbose -v --output-format= -o"
			;;
		"primary-ctrl-caps")
		opts+=" --output-format= -o --human-readable -H"
			;;
		"list-secondary")
		opts+=" --cntid= -c --namespace-id= n --num-entries -e \
			--output-format= -o"
			;;
		"ns-descs")
		opts+=" --namespace-id= -n --output-format -o --raw-binary -b"
			;;
		"id-nvmset")
		opts+=" --nvmeset-id= -i --output-format= -o"
			;;
		"id-uuid")
		opts+=" --output-format= -o --raw-binary -b --human-readable -H"
			;;
		"list-endgrp")
		opts+=" --endgrp-id= -i --output-format= -o"
			;;
		"id-iocs")
		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 \
			--nphndls= -n --nsze-si= -S --ncap-si= -C --azr -z --rar= -r \
			--ror= -O --rnumzrwa= -u --phndls= -p --endg-id= -e"
			;;
		"delete-ns")
		opts+=" -namespace-id= -n --timeout= -t"
			;;
		"attach-ns")
		opts+=" --namespace-id= -n --controllers= -c"
			;;
		"detach-ns")
		opts+=" --namespace-id= -n --controllers= -c"
			;;
		"get-ns-id")
		opts+=$NO_OPTS
			;;
		"get-log")
		opts+=" --log-id= -i --log-len= -l --namespace-id= -n \
			--aen= -a --lpo= -O --lsp= -s --lsi= -S \
			--rae -r --uuid-index= -U --csi= -y --ot -O \
			--raw-binary -b"
			;;
		"supported-log-pages")
		opts+=" --output-format= -o --human-readable -H"
			;;
		"telemetry-log")
		opts+=" --output-file= -O --host-generate= -g \
			--controller-init -c --data-area= -d"
			;;
		"fw-log")
		opts+=" --raw-binary -b --output-format= -o"
			;;
		"changed-ns-list-log")
		opts+=" --output-format= -o --raw-binary -b"
			;;
		"smart-log")
		opts+=" --namespace-id= -n --raw-binary -b \
			--output-format= -o --verbose -v"
			;;
		"ana-log")
		opts+=" --output-format -o"
			;;
		"fid-support-effects-log")
		opts+=" --output-format -o"
			;;
		"error-log")
