This file is indexed.

/usr/share/bash-completion/completions/fwupdmgr is in fwupd 1.0.6-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
_fwupdmgr_cmd_list=(
	'build-firmware'
	'clear-history'
	'clear-offline'
	'clear-results'
	'downgrade'
	'get-details'
	'get-devices'
	'get-history'
	'get-releases'
	'get-remotes'
	'get-results'
	'get-updates'
	'hwids'
	'install'
	'install-prepared'
	'modify-remote'
	'monitor'
	'refresh'
	'report-history'
	'smbios-dump'
	'unlock'
	'update'
	'verify'
	'verify-update'
	'--version'
)

_fwupdmgr_opts=(
	'--verbose'
	'--offline'
	'--allow-reinstall'
	'--allow-older'
	'--force'
	'--assume-yes'
	'--no-unreported-check'
	'--no-metadata-check'
	'--no-reboot-check'
)

_show_modifiers()
{
	COMPREPLY+=( $(compgen -W '${_fwupdmgr_opts[@]}' -- "$cur") )
}

_show_device_ids()
{
	local description
	OLDIFS=$IFS
	IFS=$'\n'
	description="$(command fwupdmgr get-devices | command awk '!/DeviceId/ { line = $0 }; /DeviceId/ { print $2 " {" line "}"}')"
	COMPREPLY+=( $(compgen -W "${description}" -- "$cur") )
	IFS=$OLDIFS
}

_show_remotes()
{
	local remotes
	remotes="$(command fwupdmgr get-remotes | command awk '/Remote ID/ { print $3 }')"
	COMPREPLY+=( $(compgen -W "${remotes}" -- "$cur") )
}

_fwupdmgr()
{
	local cur prev command
	COMPREPLY=()
	cur=`_get_cword`
	prev=${COMP_WORDS[COMP_CWORD-1]}
	command=${COMP_WORDS[1]}

	case $command in
	clear-results|downgrade|get-releases|get-results|unlock|verify|verify-update)
		if [[ "$prev" = "$command" ]]; then
			_show_device_ids
		else
			_show_modifiers
		fi
		;;
	get-details|smbios-dump)
		#browse for file
		if [[ "$prev" = "$command" ]]; then
			_filedir
		#modifiers
		else
			_show_modifiers
		fi
		;;
	install)
		#find files
		if [[ "$prev" = "$command" ]]; then
			_filedir
		#device ID or modifiers
		elif [[ "$prev" = "${COMP_WORDS[2]}" ]]; then
			_show_device_ids
			_show_modifiers
		#modifiers
		else
			_show_modifiers
		fi
		;;
	modify-remote)
		#find remotes
		if [[ "$prev" = "$command" ]]; then
			_show_remotes
		#add key
		elif [[ "$prev" = "${COMP_WORDS[2]}" ]]; then
			local keys
			keys="$(command fwupdmgr get-remotes | command awk -v pattern="Remote ID:.*${prev}$" '$0~pattern{show=1; next}/Remote/{show=0}{gsub(/:.*/,"")}show')"
			COMPREPLY+=( $(compgen -W "${keys}" -- "$cur") )
		fi
		;;
	refresh)
		#find first file
		if [[ "$prev" = "$command" ]]; then
			_filedir
		#find second file
		elif [[ "$prev" = "${COMP_WORDS[2]}" ]]; then
			_filedir
		#find remote ID
		elif [[ "$prev" = "${COMP_WORDS[3]}" ]]; then
			_show_remotes
		else
			_show_modifiers
		fi
		;;
	build-firmware)
		#file in
		if [[ "$prev" = "$command" ]]; then
			_filedir
		#file out
		elif [[ "$prev" = "${COMP_WORDS[2]}" ]]; then
			_filedir
		#script
		elif [[ "$prev" = "${COMP_WORDS[3]}" ]]; then
			_filedir
		#output
		elif [[ "$prev" = "${COMP_WORDS[4]}" ]]; then
			_filedir
		else
			_show_modifiers
		fi
		;;
	*)
		#find first command
		if [[ ${COMP_CWORD} = 1 ]]; then
			COMPREPLY=( $(compgen -W '${_fwupdmgr_cmd_list[@]}' -- "$cur") )
		#modifiers for all commands
		else
			_show_modifiers
		fi
		;;
	esac

	return 0
}

complete -F _fwupdmgr fwupdmgr