summaryrefslogtreecommitdiffstats
path: root/tools/gn/gn_main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gn/gn_main.cc')
-rw-r--r--tools/gn/gn_main.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/gn/gn_main.cc b/tools/gn/gn_main.cc
index 5fa1e00..c0300ca 100644
--- a/tools/gn/gn_main.cc
+++ b/tools/gn/gn_main.cc
@@ -29,10 +29,14 @@ int main(int argc, char** argv) {
base::AtExitManager at_exit;
CommandLine::Init(argc, argv);
- std::vector<std::string> args = GetArgs(*CommandLine::ForCurrentProcess());
+ const CommandLine& cmdline = *CommandLine::ForCurrentProcess();
+ std::vector<std::string> args = GetArgs(cmdline);
std::string command;
- if (args.empty()) {
+ if (cmdline.HasSwitch("help")) {
+ // Make "--help" default to help command.
+ command = commands::kHelp;
+ } else if (args.empty()) {
command = commands::kGen;
} else {
command = args[0];