summaryrefslogtreecommitdiffstats
path: root/util/flashrom.bash-completion.tmpl
blob: afb7ae98cd7ccb151659e8483aa60fcc05acbc60 (plain)
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
# Completion file for bash
#
# This file is part of the flashrom project.
#
# Copyright 2022 Alexander Goncharov <chat@joursoir.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#

_flashrom()
{
	local cur prev OPTS
	COMPREPLY=()
	cur="${COMP_WORDS[COMP_CWORD]}"
	prev="${COMP_WORDS[COMP_CWORD-1]}"
	case $prev in
		'-r'|'--read'|'-w'|'--write'|'-v'|'--verify'|'-l'|'--layout'| \
		'--fmap-file'|'-o'|'--output'|'--flash-contents')
			local IFS=$'\n'
			compopt -o filenames
			COMPREPLY=( $(compgen -f -- $cur) )
			return 0
			;;
		'-c'|'--chip'|'--wp-range'|'--wp-region'|'-i'|'--include')
			return 0
			;;
		'-p'|'--programmer')
			COMPREPLY=( $(compgen -W "@PROGRAMMERS@" -- $cur) )
			return 0
			;;
		'-h'|'--help'|'-R'|'--version'|'-L'|'--list-supported')
			return 0
			;;
	esac
	OPTS="--help
		--version
		--read
		--write
		--verify
		--erase
		--verbose
		--chip
		--force
		--noverify
		--noverify-all
		--extract
		--layout
		--wp-disable
		--wp-enable
		--wp-list
		--wp-status
		--wp-range
		--wp-region
		--flash-name
		--flash-size
		--fmap
		--fmap-file
		--ifd
		--include
		--output
		--flash-contents
		--list-supported
		--progress
		--programmer"
	COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
	return 0
}

complete -F _flashrom flashrom