Skip to content
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

improve subcommands, convert tests from tap to pytest, improve examples #66

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aBraM-aBraM
Copy link

@aBraM-aBraM aBraM-aBraM commented Mar 1, 2024

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 of argparse_parse instead. Adding subcommands is also easier via the CMD 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.
image

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 from foo and bar 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.

* move subcommands responsibility to argparse
* remove argparse options
* add .clang-format
@cofyc-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aBraM-aBraM
To complete the pull request process, please assign cofyc
You can assign the PR to them by writing /assign @cofyc in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cofyc-bot cofyc-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 1, 2024
@aBraM-aBraM
Copy link
Author

/assign @cofyc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants