summaryrefslogtreecommitdiffstats
path: root/bash-completion
blob: 889dc41978349df991afba88c3e5cd5465d5931d (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
# mkinitcpio bash completion by Seblu <seblu@seblu.net>

_lsinitcpio ()
{
	local action="-a -h -v -x"
	local cur="${COMP_WORDS[COMP_CWORD]}"
	local caction="${COMP_WORDS[COMP_CWORD]}"
	case "$caction" in
		-*)	COMPREPLY=($(compgen -W "${action}" -- "$cur"));;
		*) _filedir;;
	esac
}

_mkinitcpio ()
{
	local action="-c -k -s -b -g -p -S -v -M -L -H -h"
	local cur="${COMP_WORDS[COMP_CWORD]}"
	local caction="${COMP_WORDS[COMP_CWORD-1]}"
	case "$caction" in
		-c|-g) _filedir;;
		-k) COMPREPLY=($(cd /lib/modules && compgen -d -- $cur));;
		-b) COMPREPLY=($(compgen -d "$cur" -- $cur));;
		-p) COMPREPLY=($(cd /etc/mkinitcpio.d/ && compgen -X '!*.preset' -f  -- $cur|sed 's/\.preset//'));;
		-H|-S) COMPREPLY=($(cd /lib/initcpio/install/ && compgen -f -- $cur));;
		*)	COMPREPLY=($(compgen -W "${action}" -- "$cur"));;
	esac
}
complete -F _mkinitcpio mkinitcpio
complete -F _lsinitcpio lsinitcpio

# vim: set ts=2 sw=2 ft=sh noet: