-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_pyb
46 lines (40 loc) · 1.13 KB
/
_pyb
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
#compdef pyb
local -a simple_opts extended_opts
simple_opts=(
'--start-project[Initialize a new project structure]'
'-v[Verbose output]'
'-X[Debug output]'
'-h[Show help]'
)
extended_opts=(
'-q[Quiet mode]'
'-Q[Very quiet mode]'
'-C[Disable colored output]'
'--update-project[Update build descriptors and python project structure]'
'-t[Show available tasks]'
'-T[List execution plan tasks]'
)
__pyb_tasks(){
local tasks;
pyb -Qt | while read TASK_LINE; do
tasks+=( $TASK_LINE )
done
_describe -t tasks 'tasks' tasks
}
# no pyb available at all
if ! command -v pyb > /dev/null 2>&1; then
_message "unable to complete, no pyb found :("
# no build.py in current directory, presumably
elif ! pyb -Qt > /dev/null 2>&1; then
_message "unable to find a build.py, limited completion available"
_arguments -s $simple_opts
# the full monty
else
_arguments -C '*:Task:->tasks' $simple_opts $extended_opts
case "$state" in
(tasks)
_arguments -s $simple_opts $extended_opts
__pyb_tasks
;;
esac
fi