-
Notifications
You must be signed in to change notification settings - Fork 5
Throw exception when option is overridden #91
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
Conversation
emitWarnings = | ||
let toWarnings o l = | ||
fmap (uncurry . flip $ DuplicateOption.DuplicateOption o) | ||
. reverse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should refactor this to avoid reverse
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out this is not worth the trouble. Plus usually the list will have one or two elements here.
Note that this is a change in behavior since previously some places that would throw an exception will now merely emit a warning. |
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. |
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. |
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 ignorex
.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)