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

Ensures the handling of OPTARG is consistent with Bash’s getopts #30

Merged
merged 8 commits into from
Dec 14, 2024

Conversation

UrsaDK
Copy link
Owner

@UrsaDK UrsaDK commented Dec 14, 2024

Implements the fix from PR #16 and updates the tests to use declare for validating the value of OPTARG.

UrsaDK and others added 8 commits December 14, 2024 19:51
* Clear instead of unset OPTARG for valid long option without argument

This PR clears OPTARG (as opposed to `unset OPTARG`) for a valid long option without a required argument (e.g. `--charlie`). I believe this matches the behavior of builtin `getopts` for valid short options without an argument.

* Redeclare OPTARG instead of clear
Copy link

codecov bot commented Dec 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (449d7d1) to head (c6e5695).

Additional details and impacted files

@UrsaDK UrsaDK merged commit b07e2ac into master Dec 14, 2024
3 checks passed
@UrsaDK UrsaDK deleted the gh-16 branch December 14, 2024 20:56
UrsaDK added a commit that referenced this pull request Dec 15, 2024
Implements the fix from PR #16 and updates the tests to use `declare` for validating OPTARG.

Co-authored-by: Will Allan <billyzkid@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants