summaryrefslogtreecommitdiffstats
path: root/src/ninja.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-12-05 20:03:04 (GMT)
committerEvan Martin <martine@danga.com>2011-12-05 20:59:41 (GMT)
commit47596e82821e47de0504bdca961f292f77047305 (patch)
treebb2d340a5bb9b84e258358f72b15587196723252 /src/ninja.cc
parent3d17415c4672348d0892e71b15d850a66f95a095 (diff)
downloadNinja-47596e82821e47de0504bdca961f292f77047305.zip
Ninja-47596e82821e47de0504bdca961f292f77047305.tar.gz
Ninja-47596e82821e47de0504bdca961f292f77047305.tar.bz2
split out tool list into a separate subcommand
Fits the -h output on one screen again, and allows more whitespace in both the -h output and the tool list.
Diffstat (limited to 'src/ninja.cc')
-rw-r--r--src/ninja.cc41
1 files changed, 27 insertions, 14 deletions
diff --git a/src/ninja.cc b/src/ninja.cc
index a46980e..808099c 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -52,27 +52,21 @@ void Usage(const BuildConfig& config) {
"\n"
"if targets are unspecified, builds the 'default' target (see manual).\n"
"targets are paths, with additional special syntax:\n"
-" target^ means 'the first output that uses target'.\n"
+" 'target^' means 'the first output that uses target'.\n"
" example: 'ninja foo.cc^' will likely build foo.o.\n"
"\n"
"options:\n"
+" -C DIR change to DIR before doing anything else\n"
" -f FILE specify input build file [default=build.ninja]\n"
+"\n"
" -j N run N jobs in parallel [default=%d]\n"
" -k N keep going until N jobs fail [default=1]\n"
" -n dry run (don't run commands but pretend they succeeded)\n"
-" -v show all command lines\n"
-" -C DIR change to DIR before doing anything else\n"
+" -v show all command lines while building\n"
"\n"
-" -t TOOL run a subtool.\n"
-" terminates toplevel options; further flags are passed to the tool.\n"
-" tools are:\n"
-" browse browse dependency graph in a web browser\n"
-" graph output graphviz dot file for targets\n"
-" query show inputs/outputs for a path\n"
-" targets list targets by their rule or depth in the DAG\n"
-" rules list all rules\n"
-" commands list all commands required to rebuild given targets\n"
-" clean clean built files\n",
+" -t TOOL run a subtool\n"
+" use '-t list' to list subtools.\n"
+" terminates toplevel options; further flags are passed to the tool.\n",
config.parallelism);
}
@@ -448,6 +442,22 @@ int CmdClean(State* state, int argc, char* argv[], const BuildConfig& config) {
}
}
+/// Print out a list of tools.
+int CmdList(State* state, int argc, char* argv[]) {
+ printf("subtools:\n"
+" clean clean built files\n"
+"\n"
+" browse browse dependency graph in a web browser\n"
+" graph output graphviz dot file for targets\n"
+" query show inputs/outputs for a path\n"
+"\n"
+" targets list targets by their rule or depth in the DAG\n"
+" rules list all rules\n"
+" commands list all commands required to rebuild given targets\n"
+ );
+ return 0;
+}
+
} // anonymous namespace
int main(int argc, char** argv) {
@@ -548,9 +558,12 @@ reload:
// the tool, i.e. "clean".
if (tool == "clean")
return CmdClean(&state, argc+1, argv-1, config);
+ if (tool == "list")
+ return CmdClean(&state, argc+1, argv-1, config);
const char* suggestion = SpellcheckString(tool,
- "graph", "query", "browse", "targets", "rules", "commands", NULL);
+ "graph", "query", "browse", "targets", "rules", "commands", "list",
+ NULL);
if (suggestion) {
Error("unknown tool '%s', did you mean '%s'?", tool.c_str(), suggestion);
} else {