Possible commandline parsing bug for commands #3430
-
If I define the following command: def elmMake(
debug:mainargs.Flag,
optimize:mainargs.Flag,
@mainargs.arg(doc = "Specify the name of the resulting JS file.")
output:Option[String],
@mainargs.arg(doc="You can say --report=json to get error messages as JSON.")
report:Option[String],
@mainargs.arg(doc = "Generate a JSON file of documentation for a package.")
docs:Option[String],
elmFiles:mainargs.Leftover[String]
) = T.command {
T.log.info("Running elm make command:")
T.log.info(s"Debug: $debug")
T.log.info(s"Optimize: $optimize")
T.log.info(s"Output: $output")
T.log.info(s"Report: $report")
T.log.info(s"Docs: $docs")
T.log.info(s"Elm Files: ${elmFiles.value.mkString(",")}")
} I expect that the left overs is how I specify argument processing, and that things like: output, report, and docs are command line options. However when I call this command mill seems to be treating all my strings as positional:
Am I doing something wrong here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This is because Mill allows positional command line arguments This is not the MainArgs default, but was grandfathered in for backwards compatibility since Mill's behavior predates mainargs. We should flip it to be consistent with mainargs and add a flag for backwards compat for anyone who needs it |
Beta Was this translation helpful? Give feedback.
Should be fixed in #3431