Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: tools/gn/gn_main.cc

Issue 1939603002: gn: Stop printing all help when the command is unknown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "tools/gn/commands.h" 9 #include "tools/gn/commands.h"
10 #include "tools/gn/err.h" 10 #include "tools/gn/err.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 const commands::CommandInfoMap& command_map = commands::GetCommands(); 68 const commands::CommandInfoMap& command_map = commands::GetCommands();
69 commands::CommandInfoMap::const_iterator found_command = 69 commands::CommandInfoMap::const_iterator found_command =
70 command_map.find(command); 70 command_map.find(command);
71 71
72 int retval; 72 int retval;
73 if (found_command != command_map.end()) { 73 if (found_command != command_map.end()) {
74 retval = found_command->second.runner(args); 74 retval = found_command->second.runner(args);
75 } else { 75 } else {
76 Err(Location(), 76 Err(Location(), "Command \"" + command + "\" unknown.").PrintToStdout();
77 "Command \"" + command + "\" unknown.").PrintToStdout(); 77 OutputString(
78 commands::RunHelp(std::vector<std::string>()); 78 "Available commands (type \"gn help <command>\" for more details):\n");
79 for (const auto& cmd : commands::GetCommands())
80 PrintShortHelp(cmd.second.help_short);
81
79 retval = 1; 82 retval = 1;
80 } 83 }
81 84
82 exit(retval); // Don't free memory, it can be really slow! 85 exit(retval); // Don't free memory, it can be really slow!
83 } 86 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698