Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: tools/gn/command_help.cc

Issue 1021923002: Add a "gn help all" option to GN to print all of the help at once. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn_help
Patch Set: review feedback - remove braces and blank lines Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_help.cc
diff --git a/tools/gn/command_help.cc b/tools/gn/command_help.cc
index d4f5ca5a32f556a04769e6d50b9d65fc065f82d7..cf67a06244777cbd8b817cc24abb0b49fc3b8c77 100644
--- a/tools/gn/command_help.cc
+++ b/tools/gn/command_help.cc
@@ -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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698