| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); | 80 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
| 81 bool is_markdown = cmdline->HasSwitch(switches::kMarkdown); | 81 bool is_markdown = cmdline->HasSwitch(switches::kMarkdown); |
| 82 | 82 |
| 83 OutputString("Available global switches\n", DECORATION_YELLOW); | 83 OutputString("Available global switches\n", DECORATION_YELLOW); |
| 84 OutputString( | 84 OutputString( |
| 85 " Do \"gn help --the_switch_you_want_help_on\" for more. Individual\n" | 85 " Do \"gn help --the_switch_you_want_help_on\" for more. Individual\n" |
| 86 " commands may take command-specific switches not listed here. See the\n" | 86 " commands may take command-specific switches not listed here. See the\n" |
| 87 " help on your specific command for more.\n\n"); | 87 " help on your specific command for more.\n\n"); |
| 88 | 88 |
| 89 if (is_markdown) | 89 if (is_markdown) |
| 90 OutputString("```\n\n", DECORATION_NONE); | 90 OutputString("```\n", DECORATION_NONE); |
| 91 | 91 |
| 92 for (const auto& s : switches::GetSwitches()) | 92 for (const auto& s : switches::GetSwitches()) |
| 93 PrintShortHelp(s.second.short_help); | 93 PrintShortHelp(s.second.short_help); |
| 94 | 94 |
| 95 if (is_markdown) | 95 if (is_markdown) |
| 96 OutputString("\n```\n", DECORATION_NONE); | 96 OutputString("```\n", DECORATION_NONE); |
| 97 | 97 |
| 98 OutputString("\n"); | 98 OutputString("\n"); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void PrintAllHelp() { | 101 void PrintAllHelp() { |
| 102 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); | 102 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
| 103 bool is_markdown = cmdline->HasSwitch(switches::kMarkdown); | 103 bool is_markdown = cmdline->HasSwitch(switches::kMarkdown); |
| 104 | 104 |
| 105 if (is_markdown) { | 105 if (is_markdown) { |
| 106 OutputString("# GN Reference\n\n"); | 106 OutputString("# GN Reference\n\n"); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 OutputString("Run `gn help` for a list of available topics.\n", | 308 OutputString("Run `gn help` for a list of available topics.\n", |
| 309 DECORATION_NONE); | 309 DECORATION_NONE); |
| 310 } else { | 310 } else { |
| 311 OutputString("Did you mean `gn help " + suggestion.as_string() + "`?\n", | 311 OutputString("Did you mean `gn help " + suggestion.as_string() + "`?\n", |
| 312 DECORATION_NONE); | 312 DECORATION_NONE); |
| 313 } | 313 } |
| 314 return 1; | 314 return 1; |
| 315 } | 315 } |
| 316 | 316 |
| 317 } // namespace commands | 317 } // namespace commands |
| OLD | NEW |