summaryrefslogtreecommitdiffstats
path: root/useful/zsh-completion/openslx/_mltk
blob: fccceb1b8e3ace0c000a37bd201071ecde557f42 (plain) (blame)
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
#compdef mltk
#autoload

typeset -A opt_args
local context state state_descr line expl

_mltk_target_modules() {
	target_modules=(`ls remote/targets/$1`)
}

local -a targets target_modules
_targets=(`ls remote/targets`)

_arguments \
	"--help[display help text]: :->help" \
	"-n[-n \[name\] bind mount all the local builds (remote/builds) to /export/builds or /export/\[name\]]: :->bind" \
	"*:: :->target" && return 0

if (( CURRENT == 1 )); then
	_describe -t commands "mltk Targets" _targets
	return
fi

case "$state" in
	target)
		_mltk_target_modules $words[1]
		_arguments \
			"-c[-c \[module\]* clean build directory of module(s) and target dir]:*: :->modules" \
			"-b[-b \[module\]* build module(s) and copy them to the target build directory]:*: :->modules" \
			"-d[activates debug output for the task (spamy)]" \
			&& return 0


		if [[ "$state" == modules ]]; then
			_arguments \
				"-c[-c \[module\]* clean build directory of module(s) and target dir]" \
				"-b[-b \[module\]* build module(s) and copy them to the target build directory]" \
				"-d[activates debug output for the task (spamy)]: :->debug" \
				"*:Modules in Target $words[1]:($target_modules)" && return 0
		fi
	;;
esac