diff options
author | Nicolas Despres <nicolas.despres@gmail.com> | 2011-04-10 17:57:28 (GMT) |
---|---|---|
committer | Nicolas Despres <nicolas.despres@gmail.com> | 2011-04-26 11:20:08 (GMT) |
commit | bdcd695f7f32ad69b226b67d5febaf9140edb649 (patch) | |
tree | 4e590c385532a0b13174d3b3e052985ade11341a /src/ninja.cc | |
parent | 529f52e73106e9a744b433e574467a945f6c6d26 (diff) | |
download | Ninja-bdcd695f7f32ad69b226b67d5febaf9140edb649.zip Ninja-bdcd695f7f32ad69b226b67d5febaf9140edb649.tar.gz Ninja-bdcd695f7f32ad69b226b67d5febaf9140edb649.tar.bz2 |
Do not always require a target when a tool is run.
Adjust tools options parser and documentation.
Diffstat (limited to 'src/ninja.cc')
-rw-r--r-- | src/ninja.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ninja.cc b/src/ninja.cc index 9a9a771..4166a49 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -107,6 +107,10 @@ int CmdGraph(State* state, int argc, char* argv[]) { } int CmdQuery(State* state, int argc, char* argv[]) { + if (argc == 0) { + Error("expected a target to query"); + return 1; + } for (int i = 0; i < argc; ++i) { Node* node = state->GetNode(argv[i]); if (node) { @@ -136,6 +140,10 @@ int CmdQuery(State* state, int argc, char* argv[]) { int CmdBrowse(State* state, int argc, char* argv[]) { #ifndef WIN32 + if (argc < 1) { + Error("expected a target to browse"); + return 1; + } RunBrowsePython(state, argv[0]); #else Error("browse mode not yet supported on Windows"); @@ -175,7 +183,7 @@ int main(int argc, char** argv) { return 1; } } - if (optind >= argc) { + if (optind >= argc && tool.empty()) { Error("expected target to build"); usage(config); return 1; |