From b59fe1857e8ebcbcbe3325b78b78a0a09a4136fa Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Tue, 2 Aug 2022 03:16:54 +0200 Subject: [PATCH] lib/cli: minor refactoring to make things less confusing and nicer to use I renamed "unpositional arguments" to "options" and "positional arguments" to "arguments". This is intended to make the code more readable and easier to type out. --- src/lib/cli.cpp | 129 +++--- src/lib/cli.h++ | 30 +- src/test/cli_argument_parser.cpp | 664 +++++++++++++++---------------- src/tools/hexnet.cpp | 22 +- 4 files changed, 423 insertions(+), 422 deletions(-) diff --git a/src/lib/cli.cpp b/src/lib/cli.cpp index fd10870..32047f7 100644 --- a/src/lib/cli.cpp +++ b/src/lib/cli.cpp @@ -32,10 +32,10 @@ namespace CLI { this->present = false; } - UnpositionalArgument::UnpositionalArgument() { + Option::Option() { this->present = false; } - UnpositionalArgument::UnpositionalArgument(char shortName, std::string longName, std::string placeholder, std::string description) { + Option::Option(char shortName, std::string longName, std::string placeholder, std::string description) { this->shortName = shortName; this->longName = longName; this->description = description; @@ -43,23 +43,22 @@ namespace CLI { this->present = false; } - PositionalArgument::PositionalArgument() { + Argument::Argument() { this->present = false; } - PositionalArgument::PositionalArgument(std::string placeholder, std::string description) { + Argument::Argument(std::string placeholder, std::string description) { this->description = description; this->placeholder = placeholder; this->present = false; } // using int here bc that's how main() is defined - ArgumentsParser::ArgumentsParser(int argc, const char* const argv[], std::vector flags, std::vector unpositionalArguments, std::vector positionalArguments) { + ArgumentsParser::ArgumentsParser(int argc, const char* const argv[], std::vector flags, std::vector