Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Commit e62e684

Browse files
authored
bash_completion (#25)
* install the bash_completion script * complete for install, remove, update and list * autocomplete for ubports-qa remove
1 parent 2267ba0 commit e62e684

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

debian/install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
ubports-qa /usr/bin
2+
ubports-qa_completion /etc/bash_completion.d

ubports-qa_completion

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
_ubports-qa()
3+
{
4+
local cur prev
5+
cur="${COMP_WORDS[COMP_CWORD]}"
6+
prev="${COMP_WORDS[COMP_CWORD-1]}"
7+
case $COMP_CWORD in
8+
1) COMPREPLY=( $(compgen -W "$(ubports-qa -h |awk '/ install/,/ update/{print $1}')" -- "${cur}") );;
9+
2) [ "${prev}" = "remove" ] && COMPREPLY=( $(compgen -W "$(ubports-qa list)" -- "${cur}") );;
10+
*);;
11+
esac
12+
case $cur in
13+
-*) COMPREPLY=( $(compgen -W "$(_parse_usage ubports-qa)" -- "${cur}") );;
14+
esac
15+
16+
return 0
17+
}
18+
complete -F _ubports-qa ubports-qa

0 commit comments

Comments
 (0)