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
daml damlc init
reads build-options from daml.yaml
#16492
Conversation
compiler/damlc/lib/DA/Cli/Damlc.hs
Outdated
(errMsgs, parseResult) = parse args | ||
Command _ _ io <- handleParseResult parseResult | ||
forM_ errMsgs $ \msg -> do | ||
hPutStrLn stderr msg | ||
withProgName "damlc" io | ||
|
||
-- | Commands for which we add the args from daml.yaml build-options. | ||
cmdUseDamlYamlArgs :: [CommandName] |
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.
it's not my first time fixing a ticket like this, so I thought this would help find the place to change if we get another one.
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.
Are there any other cases that this might arise for? I'm not entirely sure of the context, but at what point will it make more sense to have a reject list, rather than an accept one
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.
thanks for pointing this out. I looked at the other constructors of CommandName
and I think DocTest
and Lint
probably need to do this too, so I added them. I also changed the type of cmdUseDamlYamlArgs
, now it's a predicate on CommandName
so we have to be exhaustive, and I've added comments explaining the False
s
compiler/damlc/lib/DA/Cli/Damlc.hs
Outdated
(errMsgs, parseResult) = parse args | ||
Command _ _ io <- handleParseResult parseResult | ||
forM_ errMsgs $ \msg -> do | ||
hPutStrLn stderr msg | ||
withProgName "damlc" io | ||
|
||
-- | Commands for which we add the args from daml.yaml build-options. | ||
cmdUseDamlYamlArgs :: [CommandName] |
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.
Are there any other cases that this might arise for? I'm not entirely sure of the context, but at what point will it make more sense to have a reject list, rather than an accept one
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.
Thanks @akrmn, you've prevented future tickets ;)
As a side note, is there any damage to forwarding flags that aren't used? |
oh, this is a fair point, you'd get an error if I'm thinking, perhaps it would make sense to have different fields in I think the problematic flags are few, though, since most commands use EDIT: #16518 |
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.
Looks good to me, thank you! The fairly ad-hoc way we collect arguments/config could be a good place to target some clean-up as part of the "improved tooling" drive.
Closes #14591