Given a Parser a
and a value of type a
is it possible to generate the relevant command-line (in textual format)? (Basically, the exact reverse of what optparse-applicative
is generally used for!)
For example, given something like...
data Args = {userName :: Text, userGroups :: Text }
parser :: Parser Args
parser = Args
<$> (strOption $ long "name")
<*> (many $ strOption $ long "group")
...how does one convert the following...
let args = Args { userName :: "testUser", userGroups :: ["system", "sudo"] }
...to...
--name=testUser --group=system --group=sudo