diff options
author | Fraser Cormack <frasercrmck@gmail.com> | 2014-10-24 19:34:06 (GMT) |
---|---|---|
committer | Fraser Cormack <frasercrmck@gmail.com> | 2014-10-24 19:34:06 (GMT) |
commit | a73e6931aebdc30a66e194e199bc662bf1cea9cb (patch) | |
tree | b223c402668dc7492af99c9faba4624594c6e96f /misc/zsh-completion | |
parent | 165b6d189c916ba1a2c19b5b193829b691150a65 (diff) | |
download | Ninja-a73e6931aebdc30a66e194e199bc662bf1cea9cb.zip Ninja-a73e6931aebdc30a66e194e199bc662bf1cea9cb.tar.gz Ninja-a73e6931aebdc30a66e194e199bc662bf1cea9cb.tar.bz2 |
Add zsh completion for targets in conjunction with -C
zsh can now list completions for targets in the directory specified by
the -C option
Diffstat (limited to 'misc/zsh-completion')
-rw-r--r-- | misc/zsh-completion | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/misc/zsh-completion b/misc/zsh-completion index 2fe16fb..af24f89 100644 --- a/misc/zsh-completion +++ b/misc/zsh-completion @@ -17,7 +17,14 @@ # . path/to/ninja/misc/zsh-completion __get_targets() { - ninja -t targets 2>/dev/null | while read -r a b; do echo $a | cut -d ':' -f1; done; + dir="." + if [ -n "${opt_args[-C]}" ]; + then + eval dir="${opt_args[-C]}" + fi + targets_command="ninja -C \"${dir}\" -t targets" + eval ${targets_command} 2>/dev/null | while read -r a b; do echo $a | cut -d ':' -f1; done; + } __get_tools() { |