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

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

Issue 1705123004: Fix styleguide violations from https://codereview.chromium.org/1681363003 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | no next file » | 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"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 variables::GetTargetVariables(); 215 variables::GetTargetVariables();
216 auto found_target_var = target_vars.find(what); 216 auto found_target_var = target_vars.find(what);
217 if (found_target_var != target_vars.end()) { 217 if (found_target_var != target_vars.end()) {
218 PrintLongHelp(found_target_var->second.help); 218 PrintLongHelp(found_target_var->second.help);
219 return 0; 219 return 0;
220 } 220 }
221 for (const auto& entry : target_vars) 221 for (const auto& entry : target_vars)
222 all_help_topics.push_back(entry.first); 222 all_help_topics.push_back(entry.first);
223 223
224 // Random other topics. 224 // Random other topics.
225 std::map<std::string, std::function<void()>> random_topics; 225 std::map<std::string, void(*)()> random_topics;
226 random_topics["all"] = PrintAllHelp; 226 random_topics["all"] = PrintAllHelp;
227 random_topics["buildargs"] = [=]() { PrintLongHelp(kBuildArgs_Help); }; 227 random_topics["buildargs"] = []() { PrintLongHelp(kBuildArgs_Help); };
228 random_topics["dotfile"] = [=]() { PrintLongHelp(kDotfile_Help); }; 228 random_topics["dotfile"] = []() { PrintLongHelp(kDotfile_Help); };
229 random_topics["grammar"] = [=]() { PrintLongHelp(kGrammar_Help); }; 229 random_topics["grammar"] = []() { PrintLongHelp(kGrammar_Help); };
230 random_topics["input_conversion"] = [=]() { 230 random_topics["input_conversion"] = []() {
231 PrintLongHelp(kInputConversion_Help); 231 PrintLongHelp(kInputConversion_Help);
232 }; 232 };
233 random_topics["label_pattern"] = [=]() { PrintLongHelp(kLabelPattern_Help); }; 233 random_topics["label_pattern"] = []() { PrintLongHelp(kLabelPattern_Help); };
234 random_topics["runtime_deps"] = [=]() { PrintLongHelp(kRuntimeDeps_Help); }; 234 random_topics["runtime_deps"] = []() { PrintLongHelp(kRuntimeDeps_Help); };
235 random_topics["source_expansion"] = [=]() { 235 random_topics["source_expansion"] = []() {
236 PrintLongHelp(kSourceExpansion_Help); 236 PrintLongHelp(kSourceExpansion_Help);
237 }; 237 };
238 random_topics["switches"] = PrintSwitchHelp; 238 random_topics["switches"] = PrintSwitchHelp;
239 auto found_random_topic = random_topics.find(what); 239 auto found_random_topic = random_topics.find(what);
240 if (found_random_topic != random_topics.end()) { 240 if (found_random_topic != random_topics.end()) {
241 found_random_topic->second(); 241 found_random_topic->second();
242 return 0; 242 return 0;
243 } 243 }
244 for (const auto& entry : random_topics) 244 for (const auto& entry : random_topics)
245 all_help_topics.push_back(entry.first); 245 all_help_topics.push_back(entry.first);
246 246
247 // No help on this. 247 // No help on this.
248 Err(Location(), "No help on \"" + what + "\".").PrintToStdout(); 248 Err(Location(), "No help on \"" + what + "\".").PrintToStdout();
249 base::StringPiece suggestion = SpellcheckString(what, all_help_topics); 249 base::StringPiece suggestion = SpellcheckString(what, all_help_topics);
250 if (suggestion.empty()) { 250 if (suggestion.empty()) {
251 OutputString("Run `gn help` for a list of available topics.\n", 251 OutputString("Run `gn help` for a list of available topics.\n",
252 DECORATION_NONE); 252 DECORATION_NONE);
253 } else { 253 } else {
254 OutputString("Did you mean `gn help " + suggestion.as_string() + "`?\n", 254 OutputString("Did you mean `gn help " + suggestion.as_string() + "`?\n",
255 DECORATION_NONE); 255 DECORATION_NONE);
256 } 256 }
257 return 1; 257 return 1;
258 } 258 }
259 259
260 } // namespace commands 260 } // namespace commands
OLDNEW
« 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