diff options
author | John W. Horigan <john@glyphic.com> | 2017-05-27 11:48:53 -0700 |
---|---|---|
committer | John W. Horigan <john@glyphic.com> | 2017-05-27 11:48:53 -0700 |
commit | 02c8a08780f10791e39331ba77e4d1c1558cbf7c (patch) | |
tree | 968729d76c071293beb278634e9d0a3756b5cab1 | |
parent | Fix unreachable code warning (diff) | |
download | args.hxx-02c8a08780f10791e39331ba77e4d1c1558cbf7c.tar.xz |
Fix variables shadowing the help member
-rw-r--r-- | args.hxx | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -1048,7 +1048,7 @@ namespace args /** Pass the help menu into an ostream */ - void Help(std::ostream &help) const + void Help(std::ostream &help_) const { bool hasoptions = false; bool hasarguments = false; @@ -1081,22 +1081,22 @@ namespace args auto progit = std::begin(proglines); if (progit != std::end(proglines)) { - help << std::string(helpParams.progindent, ' ') << *progit << '\n'; + help_ << std::string(helpParams.progindent, ' ') << *progit << '\n'; ++progit; } for (; progit != std::end(proglines); ++progit) { - help << std::string(helpParams.progtailindent, ' ') << *progit << '\n'; + help_ << std::string(helpParams.progtailindent, ' ') << *progit << '\n'; } - help << '\n'; + help_ << '\n'; for (const auto &line: description_text) { - help << std::string(helpParams.descriptionindent, ' ') << line << "\n"; + help_ << std::string(helpParams.descriptionindent, ' ') << line << "\n"; } - help << "\n"; - help << std::string(helpParams.progindent, ' ') << "OPTIONS:\n\n"; + help_ << "\n"; + help_ << std::string(helpParams.progindent, ' ') << "OPTIONS:\n\n"; for (const auto &desc: GetChildDescriptions(shortprefix, longprefix, allowJoinedShortValue ? "" : " ", allowJoinedLongValue ? longseparator : " ")) { const auto groupindent = std::get<2>(desc) * helpParams.eachgroupindent; @@ -1108,9 +1108,9 @@ namespace args { if (flagsit != std::begin(flags)) { - help << '\n'; + help_ << '\n'; } - help << std::string(groupindent + helpParams.flagindent, ' ') << *flagsit; + help_ << std::string(groupindent + helpParams.flagindent, ' ') << *flagsit; flagssize = Glyphs(*flagsit); } @@ -1118,30 +1118,30 @@ namespace args // groupindent is on both sides of this inequality, and therefore can be removed if ((helpParams.flagindent + flagssize + helpParams.gutter) > helpParams.helpindent || infoit == std::end(info)) { - help << '\n'; + help_ << '\n'; } else { // groupindent is on both sides of the minus sign, and therefore doesn't actually need to be in here - help << std::string(helpParams.helpindent - (helpParams.flagindent + flagssize), ' ') << *infoit << '\n'; + help_ << std::string(helpParams.helpindent - (helpParams.flagindent + flagssize), ' ') << *infoit << '\n'; ++infoit; } for (; infoit != std::end(info); ++infoit) { - help << std::string(groupindent + helpParams.helpindent, ' ') << *infoit << '\n'; + help_ << std::string(groupindent + helpParams.helpindent, ' ') << *infoit << '\n'; } } if (hasoptions && hasarguments && helpParams.showTerminator) { for (const auto &item: Wrap(std::string("\"") + terminator + "\" can be used to terminate flag options and force all following arguments to be treated as positional options", helpParams.width - helpParams.flagindent)) { - help << std::string(helpParams.flagindent, ' ') << item << '\n'; + help_ << std::string(helpParams.flagindent, ' ') << item << '\n'; } } - help << "\n"; + help_ << "\n"; for (const auto &line: epilog_text) { - help << std::string(helpParams.descriptionindent, ' ') << line << "\n"; + help_ << std::string(helpParams.descriptionindent, ' ') << line << "\n"; } } @@ -1151,9 +1151,9 @@ namespace args */ std::string Help() const { - std::ostringstream help; - Help(help); - return help.str(); + std::ostringstream help_; + Help(help_); + return help_.str(); } /** Parse all arguments. |