tfausak / cabal-gild

:crown: Format Haskell package descriptions.
https://hackage.haskell.org/package/cabal-gild
MIT License
47 stars 5 forks source link

Throw exception when option is overridden #91

Closed tfausak closed 3 months ago

tfausak commented 3 months ago

Fixes #80.

Previously if you passed the same option twice, Gild would silently ignore the first one and use the second one. For example:

# cabal-gild -i x -i y

That command will use y for input and ignore x.

This PR changes the behavior so that Gild will throw an exception in situations like the above. For example:

# cabal-gild -i x -i y
overriding option --input (before: x, after: y)
tfausak commented 3 months ago

Note that this is a change in behavior since previously some places that would throw an exception will now merely emit a warning.

tfausak commented 3 months ago

I think it would be better to avoid changing any existing behavior and instead only add new warnings. That way this won't have to be a breaking change, and I can focus on improving the CLI later.

tfausak commented 3 months ago

I'm now wondering if I should scrap this as well and just throw a warning in this case instead of an error. Not sure why I didn't consider that before.