Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) # perf bash and zsh completion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) # Taken from git.git's completion script.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) __my_reassemble_comp_words_by_ref()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 	local exclude i j first
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 	# Which word separators to exclude?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 	exclude="${1//[^$COMP_WORDBREAKS]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 	cword_=$COMP_CWORD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 	if [ -z "$exclude" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 		words_=("${COMP_WORDS[@]}")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 		return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	# List of word completion separators has shrunk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	# re-assemble words to complete.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 		# Append each nonempty word consisting of just
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 		# word separator characters to the current word.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 		first=t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 		while
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 			[ $i -gt 0 ] &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 			[ -n "${COMP_WORDS[$i]}" ] &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 			# word consists of excluded word separators
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 			[ "${COMP_WORDS[$i]//[^$exclude]}" = "${COMP_WORDS[$i]}" ]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 		do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 			# Attach to the previous token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 			# unless the previous token is the command name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 			if [ $j -ge 2 ] && [ -n "$first" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 				((j--))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 			fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 			first=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 			words_[$j]=${words_[j]}${COMP_WORDS[i]}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 			if [ $i = $COMP_CWORD ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 				cword_=$j
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 			fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 			if (($i < ${#COMP_WORDS[@]} - 1)); then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 				((i++))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 			else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 				# Done.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 				return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 			fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		words_[$j]=${words_[j]}${COMP_WORDS[i]}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		if [ $i = $COMP_CWORD ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 			cword_=$j
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) # Define preload_get_comp_words_by_ref="false", if the function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) # __perf_get_comp_words_by_ref() is required instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) preload_get_comp_words_by_ref="true"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) if [ $preload_get_comp_words_by_ref = "true" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	type _get_comp_words_by_ref &>/dev/null ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	preload_get_comp_words_by_ref="false"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) [ $preload_get_comp_words_by_ref = "true" ] ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) __perf_get_comp_words_by_ref()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	local exclude cur_ words_ cword_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	if [ "$1" = "-n" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		exclude=$2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		shift 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	__my_reassemble_comp_words_by_ref "$exclude"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	cur_=${words_[cword_]}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	while [ $# -gt 0 ]; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		case "$1" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		cur)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 			cur=$cur_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		prev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 			prev=${words_[$cword_-1]}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		words)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 			words=("${words_[@]}")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		cword)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 			cword=$cword_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		shift
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) # Define preload__ltrim_colon_completions="false", if the function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) # __perf__ltrim_colon_completions() is required instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) preload__ltrim_colon_completions="true"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) if [ $preload__ltrim_colon_completions = "true" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	type __ltrim_colon_completions &>/dev/null ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	preload__ltrim_colon_completions="false"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) [ $preload__ltrim_colon_completions = "true" ] ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) __perf__ltrim_colon_completions()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	if [[ "$1" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		# Remove colon-word prefix from COMPREPLY items
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		local colon_word=${1%"${1##*:}"}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		local i=${#COMPREPLY[*]}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		while [[ $((--i)) -ge 0 ]]; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 			COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) __perfcomp ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	COMPREPLY=( $( compgen -W "$1" -- "$2" ) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) __perfcomp_colon ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	__perfcomp "$1" "$2"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	if [ $preload__ltrim_colon_completions = "true" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		__ltrim_colon_completions $cur
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		__perf__ltrim_colon_completions $cur
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) __perf_prev_skip_opts ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	local i cmd_ cmds_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	let i=cword-1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	cmds_=$($cmd $1 --list-cmds)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	prev_skip_opts=()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	while [ $i -ge 0 ]; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		if [[ ${words[i]} == $1 ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 			return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		for cmd_ in $cmds_; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 			if [[ ${words[i]} == $cmd_ ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 				prev_skip_opts=${words[i]}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 				return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 			fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		((i--))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) __perf_main ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	local cmd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	cmd=${words[0]}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	COMPREPLY=()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	# Skip options backward and find the last perf command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	__perf_prev_skip_opts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	# List perf subcommands or long options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	if [ -z $prev_skip_opts ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		if [[ $cur == --* ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 			cmds=$($cmd --list-opts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 			cmds=$($cmd --list-cmds)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 		__perfcomp "$cmds" "$cur"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	# List possible events for -e option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	elif [[ $prev == @("-e"|"--event") &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		$prev_skip_opts == @(record|stat|top) ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 		local cur1=${COMP_WORDS[COMP_CWORD]}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		local raw_evts=$($cmd list --raw-dump)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		local arr s tmp result
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		if [[ "$cur1" == */* && ${cur1#*/} =~ ^[A-Z] ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 			OLD_IFS="$IFS"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 			IFS=" "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 			arr=($raw_evts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 			IFS="$OLD_IFS"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 			for s in ${arr[@]}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 			do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 				if [[ "$s" == *cpu/* ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 					tmp=${s#*cpu/}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 					result=$result" ""cpu/"${tmp^^}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 				else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 					result=$result" "$s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 				fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 			done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 			evts=${result}" "$(ls /sys/bus/event_source/devices/cpu/events)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 			evts=${raw_evts}" "$(ls /sys/bus/event_source/devices/cpu/events)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		if [[ "$cur1" == , ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 			__perfcomp_colon "$evts" ""
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 			__perfcomp_colon "$evts" "$cur1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		# List subcommands for perf commands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 			|data|help|script|test|timechart|trace) ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 			subcmds=$($cmd $prev_skip_opts --list-cmds)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 			__perfcomp_colon "$subcmds" "$cur"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		# List long option names
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		if [[ $cur == --* ]];  then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 			subcmd=$prev_skip_opts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 			__perf_prev_skip_opts $subcmd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 			subcmd=$subcmd" "$prev_skip_opts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 			opts=$($cmd $subcmd --list-opts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 			__perfcomp "$opts" "$cur"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) if [[ -n ${ZSH_VERSION-} ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	autoload -U +X compinit && compinit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	__perfcomp ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		emulate -L zsh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		local c IFS=$' \t\n'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 		local -a array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		for c in ${=1}; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 			case $c in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 			--*=*|*.) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 			*) c="$c " ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 			esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 			array[${#array[@]}+1]="$c"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		compset -P '*[=:]'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		compadd -Q -S '' -a -- array && _ret=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	__perfcomp_colon ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 		emulate -L zsh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 		local cur_="${2-$cur}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 		local c IFS=$' \t\n'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 		local -a array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 		if [[ "$cur_" == *:* ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 			local colon_word=${cur_%"${cur_##*:}"}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 		for c in ${=1}; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 			case $c in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 			--*=*|*.) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 			*) c="$c " ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 			esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 			array[$#array+1]=${c#"$colon_word"}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 		done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 		compset -P '*[=:]'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 		compadd -Q -S '' -a -- array && _ret=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	_perf ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 		local _ret=1 cur cword prev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 		cur=${words[CURRENT]}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 		prev=${words[CURRENT-1]}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 		let cword=CURRENT-1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 		emulate ksh -c __perf_main
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 		let _ret && _default && _ret=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 		return _ret
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	compdef _perf perf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) type perf &>/dev/null &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) _perf()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	if [[ "$COMP_WORDBREAKS" != *,* ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 		COMP_WORDBREAKS="${COMP_WORDBREAKS},"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 		export COMP_WORDBREAKS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	if [[ "$COMP_WORDBREAKS" == *:* ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 		COMP_WORDBREAKS="${COMP_WORDBREAKS/:/}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 		export COMP_WORDBREAKS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	local cur words cword prev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	if [ $preload_get_comp_words_by_ref = "true" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 		_get_comp_words_by_ref -n =:, cur words cword prev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 		__perf_get_comp_words_by_ref -n =:, cur words cword prev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	__perf_main
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) } &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) complete -o bashdefault -o default -o nospace -F _perf perf 2>/dev/null \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	|| complete -o default -o nospace -F _perf perf