improve subcommands, convert tests from tap to pytest, improve examples #66
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.
Subcommands
Subcommands are now easier to add. up until now matching subcommands was done in
subcommands.c
- requiring users to handle it in their own codebase. It is now taken care of inside ofargparse_parse
instead. Adding subcommands is also easier via theCMD
macro.Pytest for Tests
Previous testing was done in TAP which is a language agnostic testing thing. This is not very maintainable as perl is getting out of use.

I've switch to python as its 1000% more popular and has great testing abilities. I've also added tests. If you have ideas for more tests let me know.
Examples Change
basic.c
hasn't changed too much. I've mostly changed its output to fit json format in to easily test it and allow future testing in ease. Some macros were fully initialized with zeros and nulls I've removed because examples must be simple. In C structs which are "partially initialized" have their non explicitly set members set to zero which is the same.subcommands.c
was changed in a few ways. mainly changing names fromfoo
andbar
because they are not indicative and make it less clear to understand. I've also made use of the changes I've added to subcommands as a whole.Note
I was trying to conform to python3's
click
package as its the best way of achieving argparse in means of conforming to standards. Running an argparsed program without arguments result and printing the usages however adding no parameters but the--
sign will not show usages.Tell me your thoughts if you prefer a different flow and if so why.