Skip to content

Allow equals as long flag option-value separator#39

Merged
Ultramann merged 10 commits intomainfrom
allow-equals-as-long-flag-option-value-separator
Apr 13, 2026
Merged

Allow equals as long flag option-value separator#39
Ultramann merged 10 commits intomainfrom
allow-equals-as-long-flag-option-value-separator

Conversation

@Ultramann
Copy link
Copy Markdown
Owner

@Ultramann Ultramann commented Apr 13, 2026

This PR allows shifu to parse long option values that are separated from the option flag by an equals, e.g. --option=value. There were a number of gotchas in this one mostly pertaining to how the feature integrates with current and potential tab completion. In particular, while I figured out a way to get --option=v<tab> to complete similarly to how --option v<tab> would, it required the shell specific tab completion harnesses to get more complicated and become aware they were completing a --option= pattern.

I wasn't a fan of this complication, and further, while I tested the feature I realized that a user tab completing would be much less likely to use this feature because --opt<tab> completes to --option ; notice the space at the end there. Moreover, my original motivation to support --option=value pattern parsing because it removed ambiguity when reading invocations like cli --option value. In this situation just reading the call you're not sure if --option is a binary option and value is a positional/remaining arg or if value is associated with --option because it's a default or required option.

Given these two realizations, I ripped the completion machinery out but left the parsing machinery.

This PR also make required variables in help strings no longer surrounded by brackets, and found+fixed a bug where the recent changes to parameterized test running was leaking state between cases causing some tests to fail unexpectedly.

Ultramann added 10 commits April 5, 2026 17:23
I'm very confused why I'm seeing the beginning of
the completion replicated when I test in the shell
with
examples/tab completion --enum=m<tab>
it gives
examples/tab completion --enum=--enum\=magic
I'm not sure I like this. It complicates the shell
completion harness, and I'm not even sure a user
will ever use --option=v<tab>
@Ultramann Ultramann merged commit e4b9220 into main Apr 13, 2026
1 check passed
@Ultramann Ultramann deleted the allow-equals-as-long-flag-option-value-separator branch April 13, 2026 01:15
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.

1 participant