MCPcopy Create free account
hub / github.com/Taywee/args / Init

Function Init

examples/gitlike.cxx:59–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59void Init(const std::string &progname, std::vector<std::string>::const_iterator beginargs, std::vector<std::string>::const_iterator endargs)
60{
61 std::cout << "In Init" << std::endl;
62 args::ArgumentParser parser("");
63 parser.Prog(progname + " init");
64 args::HelpFlag help(parser, "help", "Display this help menu", {'h', "help"});
65 args::ValueFlag<std::string> templatedir(parser, "template-directory", "directory from which templates will be used", {"template"});
66 args::Flag bare(parser, "bare", "create a bare repository", {"bare"});
67 args::Flag quiet(parser, "quiet", "be quiet", {'q', "quiet"});
68 args::Positional<std::string> directory(parser, "directory", "The directory to create in", ".");
69 try
70 {
71 parser.ParseArgs(beginargs, endargs);
72 std::cout << std::boolalpha;
73 std::cout << "templatedir: " << bool{templatedir} << ", value: " << args::get(templatedir) << std::endl;
74 std::cout << "bare: " << bool{bare} << std::endl;
75 std::cout << "quiet: " << bool{quiet} << std::endl;
76 std::cout << "directory: " << bool{directory} << ", value: " << args::get(directory) << std::endl;
77 }
78 catch (args::Help)
79 {
80 std::cout << parser;
81 return;
82 }
83 catch (args::ParseError e)
84 {
85 std::cerr << e.what() << std::endl;
86 std::cerr << parser;
87 return;
88 }
89}
90
91void Add(const std::string &progname, std::vector<std::string>::const_iterator beginargs, std::vector<std::string>::const_iterator endargs)
92{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected