Make help printer
Closed this issue · 0 comments
MarkZH commented
Instead of manually formatting the -help
text, make a class that takes all the info and does all the formatting with line wraps and indentation and everything.
Help_Writer help;
help.add_title("Genetic Chess");
help.add_paragraph("Genetic chess is ...");
help.add_section("Standalone arguments");
help.add_option("-help", "Displays this help message and exists");
help.add_section("Arguments to play game");
help.add_option("-genetic", {"file name"}, {"ID number"}, "Load a genome file from <file name> and, if present, choose the genome with the given ID number");
// ...
help.print(std::cout, 72); // wrap lines at 72 characters
Internally, each help.add_X()
adds to a giant string inside the Help_Writer
class. The print()
method prints out the line with an argument for how long the lines should be before wrapping.