| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 void PrintArgHelp(const base::StringPiece& name, const Value& value) { | 105 void PrintArgHelp(const base::StringPiece& name, const Value& value) { |
| 106 OutputString(name.as_string(), DECORATION_YELLOW); | 106 OutputString(name.as_string(), DECORATION_YELLOW); |
| 107 OutputString(" Default = " + value.ToString(true) + "\n"); | 107 OutputString(" Default = " + value.ToString(true) + "\n"); |
| 108 | 108 |
| 109 if (value.origin()) { | 109 if (value.origin()) { |
| 110 std::string location, comment; | 110 std::string location, comment; |
| 111 GetContextForValue(value, &location, &comment); | 111 GetContextForValue(value, &location, &comment); |
| 112 OutputString(" " + location + "\n" + comment); | 112 OutputString(" " + location + "\n" + comment); |
| 113 } else { | 113 } else { |
| 114 OutputString(" (Internally set)\n"); | 114 OutputString(" (Internally set; try `gn help " + name.as_string() + |
| 115 "`.)\n"); |
| 115 } | 116 } |
| 116 } | 117 } |
| 117 | 118 |
| 118 int ListArgs(const std::string& build_dir) { | 119 int ListArgs(const std::string& build_dir) { |
| 119 Setup* setup = new Setup; | 120 Setup* setup = new Setup; |
| 120 setup->build_settings().set_check_for_bad_items(false); | 121 setup->build_settings().set_check_for_bad_items(false); |
| 121 if (!setup->DoSetup(build_dir, false) || !setup->Run()) | 122 if (!setup->DoSetup(build_dir, false) || !setup->Run()) |
| 122 return 1; | 123 return 1; |
| 123 | 124 |
| 124 Scope::KeyValueMap build_args; | 125 Scope::KeyValueMap build_args; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 "Or see \"gn help args\" for more variants.").PrintToStdout(); | 344 "Or see \"gn help args\" for more variants.").PrintToStdout(); |
| 344 return 1; | 345 return 1; |
| 345 } | 346 } |
| 346 | 347 |
| 347 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kSwitchList)) | 348 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kSwitchList)) |
| 348 return ListArgs(args[0]); | 349 return ListArgs(args[0]); |
| 349 return EditArgsFile(args[0]); | 350 return EditArgsFile(args[0]); |
| 350 } | 351 } |
| 351 | 352 |
| 352 } // namespace commands | 353 } // namespace commands |
| OLD | NEW |