Given following program:
data Cli
= Serve { filePath :: FilePath }
| Inspect { filePath :: FilePath }
deriving (Show, Data, Typeable)
cliServe :: Cli
cliServe = Serve { filePath = def &= typ "Path to file" &= args }
cliInspect :: Cli
cliInspect = Inspect { filePath = def &= typ "Path to file" &= args }
Executing it leads to this help text:
$ stack run -- --help
The cli program
cli [COMMAND] ... [OPTIONS]
Common flags:
-? --help Display help message
-V --version Print version information
cli serve [OPTIONS] [Path to file]
cli inspect [OPTIONS]
-f --filepath=ITEM
For serve it gets parsed as a normal argument and for inspect as a flag.
When I change the typ of one of them to something else, it works. 😳
This also happens when I remove both typ expressions, since the name then seems to default to ITEM.
This can't be right, can it?
Given following program:
Executing it leads to this help text:
$ stack run -- --help The cli program cli [COMMAND] ... [OPTIONS] Common flags: -? --help Display help message -V --version Print version information cli serve [OPTIONS] [Path to file] cli inspect [OPTIONS] -f --filepath=ITEMFor
serveit gets parsed as a normal argument and forinspectas a flag.When I change the
typof one of them to something else, it works. 😳This also happens when I remove both
typexpressions, since the name then seems to default toITEM.This can't be right, can it?