From 7a07f4a72922de6fdb107887902a3efa4266ed16 Mon Sep 17 00:00:00 2001 From: Brett Date: Sat, 16 Sep 2023 17:50:37 -0400 Subject: [PATCH] rename internal fields away from help to subcommand --- include/blt/parse/argparse.h | 6 +++--- libraries/parallel-hashmap | 2 +- src/blt/parse/argparse.cpp | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/blt/parse/argparse.h b/include/blt/parse/argparse.h index a8f7efa..747d3b7 100755 --- a/include/blt/parse/argparse.h +++ b/include/blt/parse/argparse.h @@ -307,9 +307,9 @@ namespace blt } } loaded_args; - bool help_disabled = false; + bool subcommand_found = false; bool use_full_name = false; - std::string help_inclusion; + std::string subcommand_name; private: static std::string getMetavar(const arg_properties_t* const& arg); @@ -430,7 +430,7 @@ namespace blt inline void setHelpExtras(std::string str) { - help_inclusion = std::move(str); + subcommand_name = std::move(str); } static std::string filename(const std::string& path); diff --git a/libraries/parallel-hashmap b/libraries/parallel-hashmap index 77cab81..93201da 160000 --- a/libraries/parallel-hashmap +++ b/libraries/parallel-hashmap @@ -1 +1 @@ -Subproject commit 77cab8192a879e5d27188f97e8f2080dd7e36ca8 +Subproject commit 93201da2ba5a6aba0a6e57ada64973555629b3e3 diff --git a/src/blt/parse/argparse.cpp b/src/blt/parse/argparse.cpp index b6cc95b..75e5572 100755 --- a/src/blt/parse/argparse.cpp +++ b/src/blt/parse/argparse.cpp @@ -362,7 +362,7 @@ namespace blt case arg_action_t::SUBCOMMAND: { loaded_args[flag] = true; - help_disabled = true; + subcommand_found = true; break; } case arg_action_t::EXTEND: @@ -414,10 +414,10 @@ namespace blt loaded_args.program_name = tokenizer.get(); tokenizer.advance(); - if (!help_inclusion.empty()) + if (!subcommand_name.empty()) { // advance the tokenizer to post grouped args allowing for flags - while (tokenizer.hasCurrent() && tokenizer.get() != help_inclusion) + while (tokenizer.hasCurrent() && tokenizer.get() != subcommand_name) tokenizer.advance(); tokenizer.advance(); } @@ -426,7 +426,7 @@ namespace blt while (tokenizer.hasCurrent()) { // if we find an arg which disables help (basically a grouping flag) then we should stop processing args - if (help_disabled) + if (subcommand_found) break; if (tokenizer.isFlag()) @@ -498,7 +498,7 @@ namespace blt void arg_parse::printHelp() const { - if (help_disabled) + if (subcommand_found) return; if (!user_args.prefix.empty()) { @@ -558,9 +558,9 @@ namespace blt void arg_parse::printUsage() const { - if (help_disabled) + if (subcommand_found) return; - std::string usage = "Usage: " + getProgramName() + " " + help_inclusion + " "; + std::string usage = "Usage: " + getProgramName() + " " + subcommand_name + " "; std::cout << usage; size_t current_line_length = 0;