File: bash-completion

package info (click to toggle)
fwupdate 8-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 472 kB
  • ctags: 308
  • sloc: ansic: 3,114; makefile: 318; sh: 152
file content (27 lines) | stat: -rwxr-xr-x 427 bytes parent folder | download
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" -- "$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