lib/cli: Implement the "Additional Info" feature
parent
9ce35b5c6b
commit
17792ec5bf
|
@ -1,5 +1,8 @@
|
||||||
// Copyright 2022, FOSS-VG Developers and Contributers
|
// Copyright 2022, FOSS-VG Developers and Contributers
|
||||||
//
|
//
|
||||||
|
// Author(s):
|
||||||
|
// BodgeMaster, Shwoomple
|
||||||
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify it
|
// This program is free software: you can redistribute it and/or modify it
|
||||||
// under the terms of the GNU Affero General Public License as published
|
// under the terms of the GNU Affero General Public License as published
|
||||||
// by the Free Software Foundation, version 3.
|
// by the Free Software Foundation, version 3.
|
||||||
|
@ -318,6 +321,10 @@ namespace CLI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this->additionalInfo != "") {
|
||||||
|
usageString += "\nAdditional Info:\n\n\t" + this->additionalInfo + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
return usageString;
|
return usageString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -746,5 +746,19 @@ int main() {
|
||||||
ASSERT(noCLIParser.getUsage() == "Help: universecreator\n\n\tCreate a universe with a banana and an apple.\n\nUsage: universecreator \n");
|
ASSERT(noCLIParser.getUsage() == "Help: universecreator\n\n\tCreate a universe with a banana and an apple.\n\nUsage: universecreator \n");
|
||||||
std::cout << "Passed no CLI input usage test." << std::endl;
|
std::cout << "Passed no CLI input usage test." << std::endl;
|
||||||
|
|
||||||
|
// additional info test ############################################
|
||||||
|
std::vector<CLI::Flag> additionalInfoCLIFlags;
|
||||||
|
|
||||||
|
std::vector<CLI::Option> additionalInfoCLIOptions;
|
||||||
|
|
||||||
|
std::vector<CLI::Argument> additionalInfoCLIArguments;
|
||||||
|
|
||||||
|
const char** additionalInfoCLICommand = new const char*[1];
|
||||||
|
additionalInfoCLICommand[0] = "universecreator";
|
||||||
|
CLI::ArgumentsParser additionalInfoCLIParser = CLI::ArgumentsParser(1, additionalInfoCLICommand, additionalInfoCLIFlags, additionalInfoCLIOptions, additionalInfoCLIArguments, "Create a universe with a banana and an apple.", "Rick Astley was here.");
|
||||||
|
|
||||||
|
ASSERT(additionalInfoCLIParser.getUsage() == "Help: universecreator\n\n\tCreate a universe with a banana and an apple.\n\nUsage: universecreator \n\nAdditional Info:\n\n\tRick Astley was here.\n");
|
||||||
|
std::cout << "Passed additional info test." << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue