archmage enum
The enum subcommand generates typed enum code from definition files, supporting 12 target languages including Go, C#, Java, Python, TypeScript, JavaScript, Lua, GDScript, C++, Rust, PHP, and Protocol Buffers.
See Enum Definition and Enum Code Features for more information.
archmage enum -t <template> -o <output-dir> <file1> [<file2> ...]Input files may be specified as literal paths or glob patterns.
# Generate Go code from a single filearchmage enum -t go -o ./enums idl/combat.enum.yaml
# Generate C# code from multiple files using a globarchmage enum -t cs -o ./Enums "idl/*.enum.yaml"Essential
Section titled “Essential”--output-dir / -o
Section titled “--output-dir / -o”The directory where generated files are written.
--template / -t
Section titled “--template / -t”The code template to use. Accepts either a built-in template name (see Built-in Templates) or a path to a custom template file.
archmage enum -t go -o ./enums idl/combat.enum.yamlarchmage enum -t ./my-enum.tpl -o ./enums idl/combat.enum.yamlFiltering
Section titled “Filtering”--xflags / -x
Section titled “--xflags / -x”Comma-separated scenario flags. When set, enum types and items whose xflags don’t match are excluded from the output.
# Generate enums matching the client scenarioarchmage enum -t go -o ./enums -x c idl/combat.enum.yaml
# Include both client and serverarchmage enum -t go -o ./enums -x c,s idl/combat.enum.yamlOthers
Section titled “Others”--banner
Section titled “--banner”Print the Archmage banner on startup.
--crlf
Section titled “--crlf”Write all output files with CRLF (\r\n) line endings instead of LF (\n).
Change the working directory before running. Relative paths are resolved from this directory.
archmage enum -t go -o ./enums --cwd /workspace/game idl/combat.enum.yaml--dotenv
Section titled “--dotenv”Load environment variables from the specified file before running. If omitted and a .env file exists in the working directory, it’s loaded automatically.
archmage enum -t go -o ./enums --dotenv config/archmage.env idl/combat.enum.yaml--dry-run
Section titled “--dry-run”Process all input files and validate them without writing any output. Useful for checking that definition files are well-formed before committing to generation.
archmage enum -t go -o ./enums --dry-run idl/combat.enum.yaml--int-bit-size
Section titled “--int-bit-size”The bit size of the int and uint types — either 32 or 64 (default: 64).
archmage enum -t go -o ./enums --int-bit-size 32 idl/combat.enum.yaml--verbose / -v
Section titled “--verbose / -v”Print extra status messages.
Built-in Templates
Section titled “Built-in Templates”| Name | Language |
|---|---|
go |
Go |
cs |
C# |
java |
Java |
py |
Python |
ts |
TypeScript |
js |
JavaScript |
lua |
Lua |
gd |
GDScript |
cpp |
C++ |
rs |
Rust |
php |
PHP |
proto |
Protocol Buffers |
Environment Variables
Section titled “Environment Variables”Environment variables fine-tune output behavior for things that require cross-layer penetration — file naming, indentation style, language-specific options, etc.
Common
Section titled “Common”These variables are recognized by all or most built-in templates.
| Variable | Default | Description |
|---|---|---|
ARCHMAGE_FILE_NAMING_STYLE |
Varies by template | Naming style for output files. Common values: snake, kebab, pascal, camel. When omitted, each template falls back to its own default (e.g. pascal for C#). |
ARCHMAGE_INDENT_STYLE |
Varies by template | Indentation style: tab or space. Not applicable to the Go template — Go output is always formatted by gofmt. |
ARCHMAGE_INDENT_TAB_SIZE |
Varies by template | Number of spaces per indent level when ARCHMAGE_INDENT_STYLE is space. Each template has its own default (commonly 2 or 4). Not applicable to the Go template. |
ARCHMAGE_OUTPUT_ENV |
— | When set to true, generates an archmage.env file alongside the enum output. It records all environment variables used by the current template, which is useful for build reproducibility and debugging. |
Language-specific
Section titled “Language-specific”| Variable | Default | Description |
|---|---|---|
ARCHMAGE_CPP_STRING_TYPE(Template: cpp) |
string |
C++ string type used in generated code. Valid values: string, wstring, u8string, u16string, u32string. |
ARCHMAGE_JS_MODULE(Template: js, ts) |
esm |
Module system. esm → ES module syntax with .mjs/.mts extension; cjs → CommonJS syntax with .cjs/.cts extension. |
ARCHMAGE_LUA_VERSION_LT53(Template: lua) |
false |
Set to true for Lua < 5.3 compatibility. This generates bitwise operation fallbacks for environments that lack native bitwise operators. |