aboutsummaryrefslogtreecommitdiff
path: root/data/shell-completions
diff options
context:
space:
mode:
authorEric Engestrom <eric@engestrom.ch>2017-12-17 21:06:07 +0000
committerEric Engestrom <eric.engestrom@intel.com>2019-02-20 18:52:26 +0000
commit75f436542cf58cc54817d095788b24ea1101d95f (patch)
tree595e251a4103583b28e1dd0668c929b3930e0504 /data/shell-completions
parent1b873d62f8818fab65032286cf9d93025d99cc30 (diff)
downloadmeson-75f436542cf58cc54817d095788b24ea1101d95f.zip
meson-75f436542cf58cc54817d095788b24ea1101d95f.tar.gz
meson-75f436542cf58cc54817d095788b24ea1101d95f.tar.bz2
zsh: complete targets
Diffstat (limited to 'data/shell-completions')
-rw-r--r--data/shell-completions/zsh/_meson18
1 files changed, 16 insertions, 2 deletions
diff --git a/data/shell-completions/zsh/_meson b/data/shell-completions/zsh/_meson
index 481d04c..b48b0f8 100644
--- a/data/shell-completions/zsh/_meson
+++ b/data/shell-completions/zsh/_meson
@@ -49,8 +49,22 @@ local -a meson_commands=(
# TODO: implement build option completion
(( $+functions[__meson_build_options] )) || __meson_build_options() {}
-# TODO: implement target name completion
-(( $+functions[__meson_targets] )) || __meson_targets() {}
+
+(( $+functions[__meson_targets] )) || __meson_targets() {
+ local tests_json
+ # TODO: get builddir out of the cmdline and pass it here
+ if tests_json="$(_call_program meson meson introspect --targets)";
+ then
+ local -a tests_ids=$(_call_program python3 python3 -c 'import sys, json;
+for target in json.load(sys.stdin):
+ print(target["id"])
+' <<< "$tests_json")
+ _describe -t "tests" "Meson tests IDs" tests_ids
+ else
+ _message -r "current working directory is not a build directory"
+ fi
+}
+
# `meson introspect` currently can provide that information in JSON.
# We can:
# 1) pipe its output to python3 -m json.tool | grep "$alovelyregex" | cut <...>