File: 0install

package info (click to toggle)
zeroinstall-injector 2.18-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,500 kB
  • sloc: ml: 26,524; xml: 2,700; ansic: 319; sh: 236; makefile: 133; python: 105
file content (28 lines) | stat: -rw-r--r-- 815 bytes parent folder | download | duplicates (7)
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
_0install_completion() {
	local c IFS=$'\n'
	COMPREPLY=()
	local TO_FILTER=()
	local WORD=${COMP_WORDS[$COMP_CWORD]}

	if [ "$WORD" == "=" ]; then
	  WORD=""
	fi

	local RESULTS=$(COMP_CWORD=$COMP_CWORD ${COMP_WORDS[0]} _complete bash "${COMP_WORDS[@]}")
	while read item
	do
		#echo "item>$item<" >&2
		case "$item" in
			add\ *) COMPREPLY=(${COMPREPLY[@]} ${item/#add /}) ;;
			filter\ *) TO_FILTER=(${TO_FILTER[@]} ${item/#filter /}) ;;
			prefix\ *) COMPREPLY=(${COMPREPLY[@]} ${item/#prefix /}) ;;
			file) COMPREPLY=(${COMPREPLY[@]} $(compgen -A file "$WORD")) ;;
			"") ;;
			*) echo 1>&2 Bad reply $item ;;
		esac
	done <<< "$RESULTS"
	if (( ${#TO_FILTER[@]} > 0 )); then
		COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "${TO_FILTER[*]}" -- "$WORD" ) )
	fi
}
complete -o nospace -F _0install_completion 0install