lib/cli: Add fields for a short description and additional usage information to the arguments parser
This is in preparation for building the help text generator.BodgeMaster-unfinished
parent
d0d02fc8d2
commit
69f15e928a
|
@ -189,6 +189,15 @@ namespace CLI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArgumentsParser::ArgumentsParser(int argc, const char* const argv[], std::vector<Flag> flags, std::vector<UnpositionalArgument> unpositionalArguments, std::vector<PositionalArgument> positionalArguments, std::string description): ArgumentsParser::ArgumentsParser(argc, argv, flags, unpositionalArguments, positionalArguments) {
|
||||||
|
this->description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArgumentsParser::ArgumentsParser(int argc, const char* const argv[], std::vector<Flag> flags, std::vector<UnpositionalArgument> unpositionalArguments, std::vector<PositionalArgument> positionalArguments, std::string description, std::string additionalInfo): ArgumentsParser::ArgumentsParser(argc, argv, flags, unpositionalArguments, positionalArguments) {
|
||||||
|
this->description = description;
|
||||||
|
this->additionalInfo = additionalInfo;
|
||||||
|
}
|
||||||
|
|
||||||
ArgumentsParser::~ArgumentsParser() {
|
ArgumentsParser::~ArgumentsParser() {
|
||||||
//TODO: check that this actually runs
|
//TODO: check that this actually runs
|
||||||
for (auto const& [shortName, flag]: this->flagsByShortName) {
|
for (auto const& [shortName, flag]: this->flagsByShortName) {
|
||||||
|
|
|
@ -68,6 +68,8 @@ namespace CLI {
|
||||||
std::map<char, UnpositionalArgument*> argumentsByShortName;
|
std::map<char, UnpositionalArgument*> argumentsByShortName;
|
||||||
std::map<std::string, UnpositionalArgument*> argumentsByLongName;
|
std::map<std::string, UnpositionalArgument*> argumentsByLongName;
|
||||||
std::vector<PositionalArgument> positionalArguments;
|
std::vector<PositionalArgument> positionalArguments;
|
||||||
|
std::string description;
|
||||||
|
std::string additionalInfo;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string programName;
|
std::string programName;
|
||||||
|
@ -76,6 +78,8 @@ namespace CLI {
|
||||||
|
|
||||||
// using int here bc that's how main() is defined
|
// using int here bc that's how main() is defined
|
||||||
ArgumentsParser(int argc, const char* const argv[], std::vector<Flag> flags, std::vector<UnpositionalArgument> unpositionalArguments, std::vector<PositionalArgument> positionalArguments);
|
ArgumentsParser(int argc, const char* const argv[], std::vector<Flag> flags, std::vector<UnpositionalArgument> unpositionalArguments, std::vector<PositionalArgument> positionalArguments);
|
||||||
|
ArgumentsParser(int argc, const char* const argv[], std::vector<Flag> flags, std::vector<UnpositionalArgument> unpositionalArguments, std::vector<PositionalArgument> positionalArguments, std::string description);
|
||||||
|
ArgumentsParser(int argc, const char* const argv[], std::vector<Flag> flags, std::vector<UnpositionalArgument> unpositionalArguments, std::vector<PositionalArgument> positionalArguments, std::string description, std::string additionalInfo);
|
||||||
~ArgumentsParser();
|
~ArgumentsParser();
|
||||||
|
|
||||||
ErrorOr<bool> getFlag(char shortName);
|
ErrorOr<bool> getFlag(char shortName);
|
||||||
|
|
Loading…
Reference in New Issue