| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 PrintShortHelp(s.second.short_help); | 85 PrintShortHelp(s.second.short_help); |
| 86 | 86 |
| 87 if (use_markdown) | 87 if (use_markdown) |
| 88 OutputString("\n```\n", DECORATION_NONE); | 88 OutputString("\n```\n", DECORATION_NONE); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void PrintAllHelp() { | 91 void PrintAllHelp() { |
| 92 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); | 92 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
| 93 if (cmdline->HasSwitch(switches::kMarkdown)) { | 93 if (cmdline->HasSwitch(switches::kMarkdown)) { |
| 94 OutputString("# GN Reference\n\n"); | 94 OutputString("# GN Reference\n\n"); |
| 95 OutputString("[TOC]\n\n"); | 95 |
| 96 // TODO: https://code.google.com/p/gitiles/issues/detail?id=75 |
| 97 // Gitiles crashes when rendering the table of contents, so we must omit |
| 98 // it until the bug is fixed. |
| 99 // OutputString("[TOC]\n\n"); |
| 96 OutputString("*This page is automatically generated from* " | 100 OutputString("*This page is automatically generated from* " |
| 97 "`gn help --markdown all`.\n\n"); | 101 "`gn help --markdown all`.\n\n"); |
| 98 } else { | 102 } else { |
| 99 PrintToplevelHelp(); | 103 PrintToplevelHelp(); |
| 100 } | 104 } |
| 101 | 105 |
| 102 for (const auto& s : switches::GetSwitches()) | 106 for (const auto& s : switches::GetSwitches()) |
| 103 PrintLongHelp(s.second.long_help); | 107 PrintLongHelp(s.second.long_help); |
| 104 | 108 |
| 105 for (const auto& c: commands::GetCommands()) | 109 for (const auto& c: commands::GetCommands()) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 return 0; | 244 return 0; |
| 241 } | 245 } |
| 242 | 246 |
| 243 // No help on this. | 247 // No help on this. |
| 244 Err(Location(), "No help on \"" + what + "\".").PrintToStdout(); | 248 Err(Location(), "No help on \"" + what + "\".").PrintToStdout(); |
| 245 RunHelp(std::vector<std::string>()); | 249 RunHelp(std::vector<std::string>()); |
| 246 return 1; | 250 return 1; |
| 247 } | 251 } |
| 248 | 252 |
| 249 } // namespace commands | 253 } // namespace commands |
| OLD | NEW |