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

Side by Side Diff: tools/gn/command_help.cc

Issue 1015063003: tools/gn: add "gn help grammar" with formal grammar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove line requested by brettw 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/gn/parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "tools/gn/err.h" 11 #include "tools/gn/err.h"
12 #include "tools/gn/functions.h" 12 #include "tools/gn/functions.h"
13 #include "tools/gn/input_conversion.h" 13 #include "tools/gn/input_conversion.h"
14 #include "tools/gn/label_pattern.h" 14 #include "tools/gn/label_pattern.h"
15 #include "tools/gn/parser.h"
15 #include "tools/gn/setup.h" 16 #include "tools/gn/setup.h"
16 #include "tools/gn/standard_out.h" 17 #include "tools/gn/standard_out.h"
17 #include "tools/gn/substitution_writer.h" 18 #include "tools/gn/substitution_writer.h"
18 #include "tools/gn/switches.h" 19 #include "tools/gn/switches.h"
19 #include "tools/gn/variables.h" 20 #include "tools/gn/variables.h"
20 21
21 namespace commands { 22 namespace commands {
22 23
23 namespace { 24 namespace {
24 25
(...skipping 26 matching lines...) Expand all
51 52
52 // Target variables. 53 // Target variables.
53 OutputString("\nVariables you set in targets (type \"gn help <variable>\" " 54 OutputString("\nVariables you set in targets (type \"gn help <variable>\" "
54 "for more details):\n"); 55 "for more details):\n");
55 for (const auto& target : variables::GetTargetVariables()) 56 for (const auto& target : variables::GetTargetVariables())
56 PrintShortHelp(target.second.help_short); 57 PrintShortHelp(target.second.help_short);
57 58
58 OutputString("\nOther help topics:\n"); 59 OutputString("\nOther help topics:\n");
59 PrintShortHelp("buildargs: How build arguments work."); 60 PrintShortHelp("buildargs: How build arguments work.");
60 PrintShortHelp("dotfile: Info about the toplevel .gn file."); 61 PrintShortHelp("dotfile: Info about the toplevel .gn file.");
62 PrintShortHelp("grammar: Formal grammar for GN build files.");
61 PrintShortHelp("label_pattern: Matching more than one label."); 63 PrintShortHelp("label_pattern: Matching more than one label.");
62 PrintShortHelp( 64 PrintShortHelp(
63 "input_conversion: Processing input from exec_script and read_file."); 65 "input_conversion: Processing input from exec_script and read_file.");
64 PrintShortHelp("source_expansion: Map sources to outputs for scripts."); 66 PrintShortHelp("source_expansion: Map sources to outputs for scripts.");
65 PrintShortHelp("switches: Show available command-line switches."); 67 PrintShortHelp("switches: Show available command-line switches.");
66 } 68 }
67 69
68 void PrintSwitchHelp() { 70 void PrintSwitchHelp() {
69 OutputString("Available global switches\n", DECORATION_YELLOW); 71 OutputString("Available global switches\n", DECORATION_YELLOW);
70 OutputString( 72 OutputString(
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 164
163 // Random other topics. 165 // Random other topics.
164 if (what == "buildargs") { 166 if (what == "buildargs") {
165 PrintLongHelp(kBuildArgs_Help); 167 PrintLongHelp(kBuildArgs_Help);
166 return 0; 168 return 0;
167 } 169 }
168 if (what == "dotfile") { 170 if (what == "dotfile") {
169 PrintLongHelp(kDotfile_Help); 171 PrintLongHelp(kDotfile_Help);
170 return 0; 172 return 0;
171 } 173 }
174 if (what == "grammar") {
175 PrintLongHelp(kGrammar_Help);
176 return 0;
177 }
172 if (what == "input_conversion") { 178 if (what == "input_conversion") {
173 PrintLongHelp(kInputConversion_Help); 179 PrintLongHelp(kInputConversion_Help);
174 return 0; 180 return 0;
175 } 181 }
176 if (what == "label_pattern") { 182 if (what == "label_pattern") {
177 PrintLongHelp(kLabelPattern_Help); 183 PrintLongHelp(kLabelPattern_Help);
178 return 0; 184 return 0;
179 } 185 }
180 if (what == "source_expansion") { 186 if (what == "source_expansion") {
181 PrintLongHelp(kSourceExpansion_Help); 187 PrintLongHelp(kSourceExpansion_Help);
182 return 0; 188 return 0;
183 } 189 }
184 if (what == "switches") { 190 if (what == "switches") {
185 PrintSwitchHelp(); 191 PrintSwitchHelp();
186 return 0; 192 return 0;
187 } 193 }
188 194
189 // No help on this. 195 // No help on this.
190 Err(Location(), "No help on \"" + what + "\".").PrintToStdout(); 196 Err(Location(), "No help on \"" + what + "\".").PrintToStdout();
191 RunHelp(std::vector<std::string>()); 197 RunHelp(std::vector<std::string>());
192 return 1; 198 return 1;
193 } 199 }
194 200
195 } // namespace commands 201 } // namespace commands
OLDNEW
« no previous file with comments | « no previous file | tools/gn/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698