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

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

Issue 819223002: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 12 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 | « tools/gn/command_gen.cc ('k') | tools/gn/command_ls.cc » ('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"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 "gn help <anything>\n" 98 "gn help <anything>\n"
99 " Yo dawg, I heard you like help on your help so I put help on the help\n" 99 " Yo dawg, I heard you like help on your help so I put help on the help\n"
100 " in the help.\n"; 100 " in the help.\n";
101 101
102 int RunHelp(const std::vector<std::string>& args) { 102 int RunHelp(const std::vector<std::string>& args) {
103 std::string what; 103 std::string what;
104 if (args.size() == 0) { 104 if (args.size() == 0) {
105 // If no argument is specified, check for switches to allow things like 105 // If no argument is specified, check for switches to allow things like
106 // "gn help --args" for help on the args switch. 106 // "gn help --args" for help on the args switch.
107 const base::CommandLine::SwitchMap& switches = 107 const base::CommandLine::SwitchMap& switches =
108 CommandLine::ForCurrentProcess()->GetSwitches(); 108 base::CommandLine::ForCurrentProcess()->GetSwitches();
109 if (switches.empty()) { 109 if (switches.empty()) {
110 // Still nothing, show help overview. 110 // Still nothing, show help overview.
111 PrintToplevelHelp(); 111 PrintToplevelHelp();
112 return 0; 112 return 0;
113 } 113 }
114 114
115 // Switch help needs to be done separately. The CommandLine will strip the 115 // Switch help needs to be done separately. The CommandLine will strip the
116 // switch separators so --args will come out as "args" which is then 116 // switch separators so --args will come out as "args" which is then
117 // ambiguous with the variable named "args". 117 // ambiguous with the variable named "args".
118 if (!PrintHelpOnSwitch(switches.begin()->first)) 118 if (!PrintHelpOnSwitch(switches.begin()->first))
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 return 0; 186 return 0;
187 } 187 }
188 188
189 // No help on this. 189 // No help on this.
190 Err(Location(), "No help on \"" + what + "\".").PrintToStdout(); 190 Err(Location(), "No help on \"" + what + "\".").PrintToStdout();
191 RunHelp(std::vector<std::string>()); 191 RunHelp(std::vector<std::string>());
192 return 1; 192 return 1;
193 } 193 }
194 194
195 } // namespace commands 195 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/command_gen.cc ('k') | tools/gn/command_ls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698