Open ndmitchell opened 9 years ago
Hey Neil!
First of all, thanks for CmdArgs, awesome work!
I just encountered this problem, my different modes have overlapping record key names, and in order to make the code a little cleaner and avoid fName, dName
, I separated my modes to different files so I could have F.name
and D.name
. But then I realized I won't be able to create a Sum Type over those without wrapping them in another constructor.
This is what it looks like right now:
-- Main.hs
data Params = WebServerParams W.Params
| FileSharingParams F.Params
deriving (Show, Typeable, Data)
-- WebServer.hs
data Params = Params { name :: String } deriving (Show, Typeable, Data)
But then, this does not quite work as CmdArgs looks only one level deep for properties.
Do you have any ideas how I could workaround this problem?
If you think I could fix this issue, please direct me to the related files and I will look into it.
Thanks in advance 👍 😁
From http://code.google.com/p/ndmitchell/issues/detail?id=291:
@aavogt says: cmdargs should support nested records:
It should be possible to use:
Which would infer flags including:
It would be nice not to have to expand the redundancy in the arguments in the usage description, but I'm not sure when or how that should be done.
@ndmitchell replied:It's possible it should just infer --optionx and --path, so the nesting is for the author of CmdArgs, not the user. Anyway, something should be done.