return 0;
}
-// Assumes DoesLineBeginWithComment().
-std::string StripCommentFromLine(const base::StringPiece& line) {
- std::string ret = line.as_string();
- for (size_t i = 0; i < ret.size(); i++) {
- if (ret[i] == '#') {
- ret[i] = ' ';
- break;
- }
- }
- return ret;
+// Assumes DoesLineBeginWithComment(), this strips the # character from the
+// beginning and normalizes preceeding whitespace.
+std::string StripHashFromLine(const base::StringPiece& line) {
+ // Replace the # sign and everything before it with 3 spaces, so that a
+ // normal comment that has a space after the # will be indented 4 spaces
+ // (which makes our formatting come out nicely). If the comment is indented
+ // from there, we want to preserve that indenting.
+ return " " + line.substr(line.find('#') + 1).as_string();
}
// Tries to find the comment before the setting of the given value.
if (!DoesLineBeginWithComment(line))
break;
- comment->insert(0, StripCommentFromLine(line) + "\n");
+ comment->insert(0, StripHashFromLine(line) + "\n");
line_off = previous_line_offset;
}
}
if (!setup->DoSetup() || !setup->Run())
return 1;
- const Scope::KeyValueMap& build_args =
- setup->build_settings().build_args().declared_arguments();
+ Scope::KeyValueMap build_args;
+ setup->build_settings().build_args().MergeDeclaredArguments(&build_args);
if (args.size() == 1) {
// Get help on a specific command.
i != build_args.end(); ++i)
sorted_args.insert(*i);
+ OutputString(
+ "Available build arguments. Note that the which arguments are declared\n"
+ "and their default values may depend on other arguments or the current\n"
+ "platform and architecture. So setting some values may add, remove, or\n"
+ "change the default value of other values.\n\n");
+
for (std::map<base::StringPiece, Value>::iterator i = sorted_args.begin();
i != sorted_args.end(); ++i) {
PrintArgHelp(i->first, i->second);