Commit a87a30b7 authored by dpranke's avatar dpranke Committed by Commit bot

Add a "gn help all" option to GN to print all of the help at once.

R=brettw@chromium.org
BUG=468851

Review URL: https://codereview.chromium.org/1021923002

Cr-Commit-Position: refs/heads/master@{#325567}
parent 1185dbb2
......@@ -57,6 +57,7 @@ void PrintToplevelHelp() {
PrintShortHelp(target.second.help_short);
OutputString("\nOther help topics:\n");
PrintShortHelp("all: Print all the help at once");
PrintShortHelp("buildargs: How build arguments work.");
PrintShortHelp("dotfile: Info about the toplevel .gn file.");
PrintShortHelp("grammar: Formal grammar for GN build files.");
......@@ -78,6 +79,32 @@ void PrintSwitchHelp() {
PrintShortHelp(s.second.short_help);
}
void PrintAllHelp() {
PrintToplevelHelp();
for (const auto& s : switches::GetSwitches())
PrintLongHelp(s.second.long_help);
for (const auto& c: commands::GetCommands())
PrintLongHelp(c.second.help);
for (const auto& f: functions::GetFunctions())
PrintLongHelp(f.second.help);
for (const auto& v: variables::GetBuiltinVariables())
PrintLongHelp(v.second.help);
for (const auto& v: variables::GetTargetVariables())
PrintLongHelp(v.second.help);
PrintLongHelp(kBuildArgs_Help);
PrintLongHelp(kDotfile_Help);
PrintLongHelp(kInputConversion_Help);
PrintLongHelp(kLabelPattern_Help);
PrintLongHelp(kSourceExpansion_Help);
PrintSwitchHelp();
}
// Prints help on the given switch. There should be no leading hyphens. Returns
// true if the switch was found and help was printed. False means the switch is
// unknown.
......@@ -163,6 +190,10 @@ int RunHelp(const std::vector<std::string>& args) {
}
// Random other topics.
if (what == "all") {
PrintAllHelp();
return 0;
}
if (what == "buildargs") {
PrintLongHelp(kBuildArgs_Help);
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment