CLI Project Commands

Create-Command

Table 7. Create-Command Flags
FlagDescriptionExample

-l, —lang

The language used for the command

—lang groovy

-f, —force

Whether to overwrite existing files

—force

The create-command command generates a standalone application that can be executed as a picocli Command. It follows a *Command convention for generating the class name. It creates an associated test that will run the application and verify that a command line option was set.

  1. $ mn create-command print
  2. | Rendered template Command.java to destination src/main/java/example/PrintCommand.java
  3. | Rendered template CommandTest.java to destination src/test/java/example/PrintCommandTest.java

This list is just a small subset of all the code generation commands in the Micronaut CLI. To see all the context-sensitive commands the CLI has available (and under what circumstances they apply), check out the micronaut-starter project and find the classes that extend CodeGenCommand. The applies method dictates whether a command is available or not.