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 <algorithm> | 5 #include <algorithm> |
6 #include <iostream> | 6 #include <iostream> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "tools/gn/args.h" | 9 #include "tools/gn/args.h" |
10 #include "tools/gn/commands.h" | 10 #include "tools/gn/commands.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 PrintLongHelp(found->second.long_help); | 145 PrintLongHelp(found->second.long_help); |
146 return true; | 146 return true; |
147 } | 147 } |
148 | 148 |
149 } // namespace | 149 } // namespace |
150 | 150 |
151 const char kHelp[] = "help"; | 151 const char kHelp[] = "help"; |
152 const char kHelp_HelpShort[] = | 152 const char kHelp_HelpShort[] = |
153 "help: Does what you think."; | 153 "help: Does what you think."; |
154 const char kHelp_Help[] = | 154 const char kHelp_Help[] = |
155 "gn help <anything>\n" | 155 R"(gn help <anything> |
156 "\n" | 156 |
157 " Yo dawg, I heard you like help on your help so I put help on the help\n" | 157 Yo dawg, I heard you like help on your help so I put help on the help in the |
158 " in the help.\n" | 158 help. |
159 "\n" | 159 |
160 " You can also use \"all\" as the parameter to get all help at once.\n" | 160 You can also use "all" as the parameter to get all help at once. |
161 "\n" | 161 |
162 "Switches\n" | 162 Switches |
163 "\n" | 163 |
164 " --markdown\n" | 164 --markdown |
165 " Format output in markdown syntax.\n" | 165 Format output in markdown syntax. |
166 "\n" | 166 |
167 "Example\n" | 167 Example |
168 "\n" | 168 |
169 " gn help --markdown all\n" | 169 gn help --markdown all |
170 " Dump all help to stdout in markdown format.\n"; | 170 Dump all help to stdout in markdown format. |
| 171 )"; |
171 | 172 |
172 int RunHelp(const std::vector<std::string>& args) { | 173 int RunHelp(const std::vector<std::string>& args) { |
173 std::string what; | 174 std::string what; |
174 if (args.size() == 0) { | 175 if (args.size() == 0) { |
175 // If no argument is specified, check for switches to allow things like | 176 // If no argument is specified, check for switches to allow things like |
176 // "gn help --args" for help on the args switch. | 177 // "gn help --args" for help on the args switch. |
177 const base::CommandLine::SwitchMap& switches = | 178 const base::CommandLine::SwitchMap& switches = |
178 base::CommandLine::ForCurrentProcess()->GetSwitches(); | 179 base::CommandLine::ForCurrentProcess()->GetSwitches(); |
179 if (switches.empty()) { | 180 if (switches.empty()) { |
180 // Still nothing, show help overview. | 181 // Still nothing, show help overview. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 OutputString("Run `gn help` for a list of available topics.\n", | 268 OutputString("Run `gn help` for a list of available topics.\n", |
268 DECORATION_NONE); | 269 DECORATION_NONE); |
269 } else { | 270 } else { |
270 OutputString("Did you mean `gn help " + suggestion.as_string() + "`?\n", | 271 OutputString("Did you mean `gn help " + suggestion.as_string() + "`?\n", |
271 DECORATION_NONE); | 272 DECORATION_NONE); |
272 } | 273 } |
273 return 1; | 274 return 1; |
274 } | 275 } |
275 | 276 |
276 } // namespace commands | 277 } // namespace commands |
OLD | NEW |