summaryrefslogtreecommitdiffstats
path: root/useful/zsh-completion/openslx/_mltk
diff options
context:
space:
mode:
Diffstat (limited to 'useful/zsh-completion/openslx/_mltk')
-rw-r--r--useful/zsh-completion/openslx/_mltk44
1 files changed, 44 insertions, 0 deletions
diff --git a/useful/zsh-completion/openslx/_mltk b/useful/zsh-completion/openslx/_mltk
new file mode 100644
index 00000000..5abf68f3
--- /dev/null
+++ b/useful/zsh-completion/openslx/_mltk
@@ -0,0 +1,44 @@
+#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 export_dirs
+_targets=(`ls remote/targets`)
+
+[ -d "/export" ] && export_dirs=(`ls /export`)
+
+_arguments \
+ "--help[display help text]: :->help" \
+ "(: -)-n[-n \[name\] bind mount all the local builds (remote/builds) to /export/builds or /export/\[name\]]:Existing folders in /export:($export_dirs)" \
+ "*:: :->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