New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to improve CLI parsing #8
Closed
Closed
Commits on Apr 12, 2017
-
The goal of this new class is to simplifie the arguments parsing, I've take inspiration from glib Commandline option parser: https://developer.gnome.org/glib/stable/glib-Commandline-option-parser.html, exept that with glib you need to specifie with a flag the type of each options, here options type are automatically determine when adding an option with parser.addOption. Basically most of the job is made in the parser contructor, here you can set the name of the program, summary, and arguments that are not options. Option like "--nwm" are set with addOption function. "--help" is automatically generated with arguments you've use in addOption and in the contructor, "--version" is generated too, and call Version::printVersion.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
In this file, "Usage: xml2ssf [<options>] [<input file>] <output file>" change to "Usage: ./bin/xml2ssf [<options>] <[input file] <output file>>". I had to use an array of stings to get input file and output file, this is because input file is the optinal argument and is before ouput file, I would be harder to handle this case automatically in cli.h, as I would need to check if there is non optinal argument after the optinal one. I could do that, but as this file is the only one that need that, I don't think it worth the effort so I just get all arguments in a vector, and let some bytes of the old parser do what's left of the job
-
Commits on Apr 13, 2017
-
Signed-off-by: Matthias Gatto <uso.cosmo.ray@gmail.com>
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.