2 # Copyright 2011 Google Inc. All Rights Reserved.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # Add the following to your .zshrc to tab-complete ninja targets
17 # . path/to/ninja/misc/zsh-completion
21 if [ -n "${opt_args[-C]}" ];
23 eval dir="${opt_args[-C]}"
25 targets_command="ninja -C \"${dir}\" -t targets all"
26 eval ${targets_command} 2>/dev/null | cut -d: -f1
30 ninja -t list 2>/dev/null | while read -r a b; do echo $a; done | tail -n +2
34 ninja -d list 2>/dev/null | while read -r a b; do echo $a; done | tail -n +2 | sed '$d'
39 modes=(${(fo)"$(__get_modes)"})
40 _describe 'modes' modes
45 tools=(${(fo)"$(__get_tools)"})
46 _describe 'tools' tools
51 targets=(${(fo)"$(__get_targets)"})
52 _describe 'targets' targets
56 {-h,--help}'[Show help]' \
57 '--version[Print ninja version]' \
58 '-C+[Change to directory before doing anything else]:directories:_directories' \
59 '-f+[Specify input build file (default=build.ninja)]:files:_files' \
60 '-j+[Run N jobs in parallel (default=number of CPUs available)]:number of jobs' \
61 '-l+[Do not start new jobs if the load average is greater than N]:number of jobs' \
62 '-k+[Keep going until N jobs fail (default=1)]:number of jobs' \
63 '-n[Dry run (do not run commands but act like they succeeded)]' \
64 '-v[Show all command lines while building]' \
65 '-d+[Enable debugging (use -d list to list modes)]:modes:__modes' \
66 '-t+[Run a subtool (use -t list to list subtools)]:tools:__tools' \
67 '*::targets:__targets'