`mill init` should provide a `--help` option
Otherwise, it's hard to know which options are available.
E.g. The page https://mill-build.org/mill/migrating/auto-migrating.html shows an example with a --jvm-id option, but when I try to use it, it fails with:
Unknown arguments: "--jvm-id" "11"
Expected Signature: run-import
Imports an SBT build located in the current working directory.
--custom-sbt <str> path to sbt executable
--merge merge generated build files
--no-meta disable generating meta-build files
The options is probably only available on the Gradle importer, but who knows?
Since there is some kind of help text available as part of the error message, we should also make it available via --help.
See also
- https://github.com/com-lihaoyi/mill/issues/6039
Otherwise, it's hard to know which options are available.
E.g. The page https://mill-build.org/mill/migrating/auto-migrating.html shows an example with a
--jvm-idoption, but when I try to use it, it fails with:Unknown arguments: "--jvm-id" "11" Expected Signature: run-import Imports an SBT build located in the current working directory. --custom-sbt <str> path to sbt executable --merge merge generated build files --no-meta disable generating meta-build filesThe options is probably only available on the Gradle importer, but who knows?
Since there is some kind of help text available as part of the error message, we should also make it available via
--help.
The actual examples do not use --jvm-id anymore. I suppose the documentation views will be updated in the next release.
The other sections are a little dated and could use a touch up.
The help message displayed is the default one logged by mainargs.Parser(this).runOrExit. I am not sure what needs to change here. Could you elaborate?
This issue isn't solved.
The help message displayed is the default one logged by
mainargs.Parser(this).runOrExit. I am not sure what needs to change here. Could you elaborate?
What looks like a "help-message" is the output of an "error-message". There is no way to see the "help-message" without causing an error. You can't see it with mill inspect and also not with adding --help to the command. Whether this is a generic issue or specific to the init command, I can't tell right now.
Below is the output using the latest version of Mill.
fs2$ ./mill init --help
No mill version specified.
You should provide a version via a '//| mill-version: ' comment or a '.mill-version' file.
Using mill version 1.1.0-RC1
[build.mill-59/64] compile
[build.mill-59] [info] compiling 3 Scala sources ...fs2/out/mill-build/compile.dest/classes ...
[build.mill-59] [info] done compiling
[1/1] init
[14/14] mill.init.InitSbtModule/init
run-import
Imports an SBT build located in the current working directory.
--custom-sbt <str> path to sbt executable
--merge merge generated build files
--no-meta disable generating meta-build files
--sbt-jvm-id <str> JDK to use to run sbt
So, the output probably depends on the contents of the workding dir, since I see this in an empty directory.
> mill init --help
Using mill version 1.1.0-RC1
[build.mill-59/64] compile
[build.mill-59] [info] compiling 3 Scala sources to /tmp/mill2/out/mill-build/compile.dest/classes ...
[build.mill-59] [info] done compiling
[1/1] init
[1/1, 1 failed] ============================== init --help ============================== 9s
1 tasks failed
[1] init java.lang.Exception: Unknown argument: "--help"
Expected Signature: init
-e exampleId <str>
--show-all
mill.util.MainModule.init$$anonfun$1(MainModule.scala:287)
mill.api.Task$Named.evaluate(Task.scala:389)
mill.api.Task$Named.evaluate$(Task.scala:374)
mill.api.Task$Command.evaluate(Task.scala:461)
``
Ideally, we should see all options, for all possible use-cases.
Off topic: Having some auto-detection is nice, but I think we should provide a ways to manually select which init-backend we want to use, e.g. for projects that contain build scripts for more than one supported build tool.
Expected Signature: init
-e exampleId <str>
--show-all
This is the original use-case for the init command; to initialize a build from an example. The command was later overloaded for the conversion use-cases.
Off topic: Having some auto-detection is nice, but I think we should provide a ways to manually select which init-backend we want to use, e.g. for projects that contain build scripts for more than one supported build tool.
Another option would be to list the explicit commands, such as mill.init.InitSbtModule/init, in the documentation.
If we don't want to show all options for all modes up front, we could introduce a --mode option, which defaults to "auto", but supports the options example, mvn, sbt, gradle and to see the mode-specific help, users could run mill init --mode sbt --help.