From a73e6931aebdc30a66e194e199bc662bf1cea9cb Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Fri, 24 Oct 2014 20:34:06 +0100 Subject: Add zsh completion for targets in conjunction with -C zsh can now list completions for targets in the directory specified by the -C option --- misc/zsh-completion | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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() { -- cgit v0.12