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" |
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 30 matching lines...) Expand all Loading... |
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."); |
61 PrintShortHelp("label_pattern: Matching more than one label."); | 62 PrintShortHelp("label_pattern: Matching more than one label."); |
62 PrintShortHelp( | 63 PrintShortHelp( |
63 "input_conversion: Processing input from exec_script and read_file."); | 64 "input_conversion: Processing input from exec_script and read_file."); |
64 PrintShortHelp("source_expansion: Map sources to outputs for scripts."); | 65 PrintShortHelp("source_expansion: Map sources to outputs for scripts."); |
| 66 PrintShortHelp("syntax: Formal syntax for GN build files."); |
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( |
71 " Do \"gn help --the_switch_you_want_help_on\" for more. Individual\n" | 73 " Do \"gn help --the_switch_you_want_help_on\" for more. Individual\n" |
72 " commands may take command-specific switches not listed here. See the\n" | 74 " commands may take command-specific switches not listed here. See the\n" |
73 " help on your specific command for more.\n\n"); | 75 " help on your specific command for more.\n\n"); |
74 | 76 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 return 0; | 176 return 0; |
175 } | 177 } |
176 if (what == "label_pattern") { | 178 if (what == "label_pattern") { |
177 PrintLongHelp(kLabelPattern_Help); | 179 PrintLongHelp(kLabelPattern_Help); |
178 return 0; | 180 return 0; |
179 } | 181 } |
180 if (what == "source_expansion") { | 182 if (what == "source_expansion") { |
181 PrintLongHelp(kSourceExpansion_Help); | 183 PrintLongHelp(kSourceExpansion_Help); |
182 return 0; | 184 return 0; |
183 } | 185 } |
| 186 if (what == "syntax") { |
| 187 PrintLongHelp(kSyntax_Help); |
| 188 return 0; |
| 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 |
OLD | NEW |