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

[GH-15] Support for adjacent variable-value syntax #20

Merged
merged 5 commits into from
Dec 10, 2024
Merged

Conversation

UrsaDK
Copy link
Owner

@UrsaDK UrsaDK commented Dec 10, 2024

@UrsaDK UrsaDK merged commit f8e8e89 into master Dec 10, 2024
1 check passed
@UrsaDK UrsaDK deleted the issue-15 branch December 10, 2024 19:15
@UrsaDK UrsaDK restored the issue-15 branch December 12, 2024 17:58
@UrsaDK UrsaDK deleted the issue-15 branch December 12, 2024 18:01
@UrsaDK
Copy link
Owner Author

UrsaDK commented Dec 13, 2024

While adding more tests for this change, I realised that this implementation opens up a whole can of worms about how options should be interpreted. For example, when a script that uses : test: tester: for its OPTSPEC is run with --testerror, should it be interpreted as “--test error” or “--tester ror”?

I also disliked the fact that the fixed introduced a for loop that could potentially execute for every option provided, as well as a dependency on the tr and sort commands.

So, I decided to revert adjacent option-value syntax implementation for long options.

Instead, the README will be updated to emphasise that getopts_long supports two syntaxes:

  • Short options are compatible with bash’s built-in getopts, supporting both -o value and -ovalue;
  • Long options follow GNU-like syntax, supporting only —option value and —option=value definitions.

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.

Double hyphen not handled correctly in some situations
1 participant