Skip to content

Conversation

@roberth
Copy link
Contributor

@roberth roberth commented Mar 5, 2021

This is a potential solution to #271 and #284, observing that both issues only seem to want to parse a fixed number of two arguments per option. That certainly applies to my use case as well.

I don't think this solution is pretty, but it is backwards compatible and it does the job.

@HuwCampbell
Copy link
Collaborator

Interesting, but yeah I agree it's a bit janky.

So I'm not sure (using GADTs is almost certainly a no though as I'm trying to keep optparse very lean).

I think if people like yourself are really needing this, the best course of action is to resurrect #284, but make the behaviour opt-in under a new Mod OptionFields a modifier which turns on the variable length consumption.

That way people can't easily foot-gun themselves, and no-one's code will break.

@roberth roberth marked this pull request as draft January 25, 2024 13:52
@MagicRB
Copy link

MagicRB commented Jan 15, 2025

@roberth did you not end up needing this, trying to translate a bash script into Haskell and need to parse --override-input nixpkgs something, you'll never guess what package manager this is for.

@roberth
Copy link
Contributor Author

roberth commented Jan 16, 2025

@MagicRB 😆

I ended up maintaining a fork with a small patch, as the proposed alternative turned out to be a major refactor that's too big for a mere mortal with a job to do.
The fork was supposed to be a temporary thing before I circled back to this, but you know how things go.

@MagicRB
Copy link

MagicRB commented Jan 16, 2025

The most temporary solutions become the most permenant, or something. I'll use your fork then, because --override-input nixpkgs=foobar is everything but nice

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.

3 participants