OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |