moon generate <id> (or moon g) command will generate code (files and folders) from a
pre-defined template of the same name, using an interactive series of prompts. Templates are located
based on the generator.templates setting.
View the official code generation guide for a more in-depth example of how to utilize this command.
Arguments
<id>
ID of the template to generate. If not provided, you will be prompted to select from available templates.
[-- <vars>]
Additional arguments to override default variable values. These are passed after -- and use the format --variableName value.
Examples:
Options
--to <path>
Destination to write files to, relative from the current working directory. If not defined, will be prompted during generation.
--defaults
Use the default value of all variables instead of prompting the user. Useful for non-interactive environments like CI/CD.
--dry-run
Run entire generator process without writing files. This is useful for testing template configuration and variable substitution.
--force
Force overwrite any existing files at the destination without prompting.
--template
Create a new template with the provided name. This will scaffold the basic structure for a new template.
Examples
Basic generation
Generate with variables
Configuration
generatorin.moon/workspace.*