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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 "gn help <anything>\n" |
| 156 "\n" |
156 " 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\n" |
157 " in the help.\n"; | 158 " in the help.\n" |
| 159 "\n" |
| 160 " You can also use \"all\" as the parameter to get all help at once.\n" |
| 161 "\n" |
| 162 "Switches\n" |
| 163 "\n" |
| 164 " --markdown\n" |
| 165 " Format output in markdown syntax.\n" |
| 166 "\n" |
| 167 "Example\n" |
| 168 "\n" |
| 169 " gn help --markdown all\n" |
| 170 " Dump all help to stdout in markdown format.\n"; |
158 | 171 |
159 int RunHelp(const std::vector<std::string>& args) { | 172 int RunHelp(const std::vector<std::string>& args) { |
160 std::string what; | 173 std::string what; |
161 if (args.size() == 0) { | 174 if (args.size() == 0) { |
162 // If no argument is specified, check for switches to allow things like | 175 // If no argument is specified, check for switches to allow things like |
163 // "gn help --args" for help on the args switch. | 176 // "gn help --args" for help on the args switch. |
164 const base::CommandLine::SwitchMap& switches = | 177 const base::CommandLine::SwitchMap& switches = |
165 base::CommandLine::ForCurrentProcess()->GetSwitches(); | 178 base::CommandLine::ForCurrentProcess()->GetSwitches(); |
166 if (switches.empty()) { | 179 if (switches.empty()) { |
167 // Still nothing, show help overview. | 180 // Still nothing, show help overview. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 OutputString("Run `gn help` for a list of available topics.\n", | 267 OutputString("Run `gn help` for a list of available topics.\n", |
255 DECORATION_NONE); | 268 DECORATION_NONE); |
256 } else { | 269 } else { |
257 OutputString("Did you mean `gn help " + suggestion.as_string() + "`?\n", | 270 OutputString("Did you mean `gn help " + suggestion.as_string() + "`?\n", |
258 DECORATION_NONE); | 271 DECORATION_NONE); |
259 } | 272 } |
260 return 1; | 273 return 1; |
261 } | 274 } |
262 | 275 |
263 } // namespace commands | 276 } // namespace commands |
OLD | NEW |