File: bash-completion

package info (click to toggle)
fwupdate 12-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 588 kB
  • sloc: ansic: 4,329; makefile: 358; sh: 49
file content (27 lines) | stat: -rwxr-xr-x 459 bytes parent folder | download | duplicates (2)
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
#!/bin/bash

_fwupdate()
{
	local cur=${COMP_WORDS[COMP_CWORD]}

	if [[ "$cur" == -* ]]; then
		COMPREPLY=( $( compgen -W "-a -l -d --set-debug -D --unset-debug" -- "$cur" ) )
		return 0
	fi

	case "${COMP_WORDS[COMP_CWORD-1]}" in
	-a)
		COMPREPLY=( $( compgen -W "$(fwupdate -l | cut -d\{ -f2 | cut -d\} -f1)" -- "$cur" ) )
		return 0
		;;
	esac

	case "${COMP_WORDS[COMP_CWORD-2]}" in
	-a)
		_filedir
		return 0
		;;
	esac
}

complete -F _fwupdate fwupdate