aboutsummaryrefslogtreecommitdiffstats
path: root/qcd.bash-completion
blob: c8dfc566b85478791edc3fbcba72e71b60c61426 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Bash completion for the qcd() function

_qcd () {
	local cur
	local shortcuts=$(awk '{ print $1 }' $QCD_DATABASE_FILE)

	COMPREPLY=()
	cur=${COMP_WORDS[COMP_CWORD]}

	case "$COMP_CWORD" in
		1|2)
			COMPREPLY=( $( compgen -W "$shortcuts" -- $cur ) )
			;;
		3)
			COMPREPLY=()
			;;
	esac

	return 0
}

complete -o default -F _qcd qcd