CLI Options Reference

This document provides a comprehensive reference for all Azu CLI commands, options, and flags.

Command Structure

All Azu CLI commands follow this structure:

azu <command> [subcommand] [options] [arguments]

Global Options

These options are available for all commands:

Option
Short
Description
Example

--help

-h

Show help for the command

azu --help

--version

-v

Show version information

azu --version

--verbose

-V

Enable verbose output

azu generate --verbose

--quiet

-q

Suppress output except errors

azu serve --quiet

--config

-c

Specify configuration file

azu --config=./custom.yml

--log-level

-l

Set log level

azu --log-level=debug

--color

Enable/disable colored output

azu --color=false

Project Commands

azu new

Create a new Azu project.

Option
Description
Default
Example

--type TYPE

Project type (web, api, cli)

web

--type api

--api

Shorthand for --type api

-

--api

--db DATABASE

Database adapter

postgresql

--db mysql

--module NAME

Module name (PascalCase)

(from project)

--module MyApp

--author NAME

Author name

(from git)

--author "John Doe"

--email EMAIL

Author email

(from git)

--email john@example.com

--license LIC

License (MIT, Apache-2.0, etc.)

MIT

--license Apache-2.0

--ci CI

CI setup

GitHub Actions

--ci "GitLab CI"

--docker

Include Docker support

false

--docker

--no-docker

Skip Docker support

-

--no-docker

--git

Initialize Git repository

true

--git

--no-git

Skip Git initialization

-

--no-git

--example

Include example code

true

--example

--no-example

Skip example code

-

--no-example

--joobq

Include JoobQ for background jobs

true

--joobq

--no-joobq

Skip JoobQ integration

-

--no-joobq

--yes

Non-interactive mode (use defaults)

false

--yes

Examples:

azu init

Initialize Azu in an existing project.

Option
Description
Default
Example

--framework

Framework to use

azu

--framework=azu

--orm

ORM to use

cql

--orm=cql

--database

Database adapter

postgresql

--database=mysql

--force

Overwrite existing config

false

--force

Examples:

Generation Commands

azu generate

Generate code components.

Common Generator Options

Option
Description
Default
Example

--force

Overwrite existing files

false

--force

--skip-tests

Skip test generation

false

--skip-tests

--api-only

Generate API components

false

--api-only

--web-only

Generate web components

false

--web-only

--skip COMP

Skip specific components

None

--skip model,page

Endpoint Generator

Option
Description
Default
Example

--methods

HTTP methods to generate

index,show,new,create,edit,update,destroy

--methods=index,show,create

--route-prefix

Route prefix

/

--route-prefix=/api/v1

--response-format

Response format

json

--response-format=html

--auth

Require authentication

false

--auth

--authorization

Add authorization

false

--authorization

--request

Generate requests

true

--skip-request

--page

Generate pages

false

--page

Examples:

Model Generator

Option
Description
Default
Example

--orm

ORM framework

cql

--orm=cql

--migration

Generate migration

true

--skip-migration

--timestamps

Include timestamps

true

--skip-timestamps

--soft-deletes

Include soft deletes

false

--soft-deletes

--validations

Add validations

true

--skip-validations

--associations

Generate associations

false

--associations

Field Types:

  • string - String field (String)

  • text - Text field (String)

  • int32 - 32-bit integer (Int32)

  • int64 - 64-bit integer (Int64)

  • float32 - 32-bit float (Float32)

  • float64 - 64-bit float (Float64)

  • bool, boolean - Boolean field (Bool)

  • time, datetime - DateTime field (Time)

  • date - Date field (Date)

  • json - JSON field (JSON::Any)

  • uuid - UUID field (UUID)

  • email - Email field (String with validation)

  • url - URL field (String with validation)

  • references, belongs_to - Foreign key reference (Int64)

Examples:

Service Generator

Option
Description
Default
Example

--methods

Service methods

create,update,destroy,find,list

--methods=create,update

--interface

Generate interface

true

--skip-interface

--transactions

Include transactions

true

--skip-transactions

--error-handling

Error handling approach

exceptions

--error-handling=results

--dependency-injection

Use dependency injection

true

--skip-di

Examples:

Page Generator

Option
Description
Default
Example

--template-engine

Template engine

jinja

--template-engine=ecr

--layout

Layout template

layout

--layout=admin

--css-framework

CSS framework

bootstrap

--css-framework=tailwind

--js-framework

JavaScript framework

vanilla

--js-framework=alpine

--forms

Include forms

true

--skip-forms

--pagination

Include pagination

false

--pagination

Examples:

Request Generator

Note: The contract generator is deprecated. Use request instead.

Option
Description
Default
Example

--force

Overwrite existing files

false

--force

Field Types: string, text, int32, int64, float32, float64, bool, time, date, json, uuid, references

Examples:

Component Generator

Option
Description
Default
Example

--type

Component type

ui

--type=form

--template-engine

Template engine

jinja

--template-engine=ecr

--css-framework

CSS framework

bootstrap

--css-framework=tailwind

--props

Include props

true

--skip-props

--slots

Include slots

false

--slots

--events

Include events

false

--events

Examples:

Middleware Generator

Option
Description
Default
Example

--type

Middleware type

custom

--type=authentication

--before

Execute before

None

--before=auth

--after

Execute after

None

--after=logging

--config

Include configuration

true

--skip-config

Examples:

Migration Generator

Option
Description
Default
Example

--table

Table name

Inferred from name

--table=users

--fields

Migration fields

None

--fields=email:string,name:string

--reversible

Make migration reversible

true

--skip-reversible

Examples:

Scaffold Generator

Option
Description
Default
Example

--skip-model

Skip model generation

false

--skip-model

--skip-endpoint

Skip endpoint generation

false

--skip-endpoint

--skip-page

Skip page generation

false

--skip-page

--skip-request

Skip request generation

false

--skip-request

--skip-service

Skip service generation

false

--skip-service

Examples:

Database Commands

azu db

Database management commands.

azu db create

Create database.

Option
Description
Default
Example

--adapter

Database adapter

From config

--adapter=postgresql

--url

Database URL

From config

--url=postgresql://localhost/myapp

--force

Force creation

false

--force

azu db drop

Drop database.

Option
Description
Default
Example

--adapter

Database adapter

From config

--adapter=postgresql

--url

Database URL

From config

--url=postgresql://localhost/myapp

--force

Force drop

false

--force

azu db migrate

Run database migrations.

Option
Description
Default
Example

--version

Target version

Latest

--version=20231201000000

--adapter

Database adapter

From config

--adapter=postgresql

--dry-run

Show what would be run

false

--dry-run

--verbose

Show detailed output

false

--verbose

azu db rollback

Rollback database migrations.

Option
Description
Default
Example

--version

Target version

Previous

--version=20231101000000

--steps

Number of steps

1

--steps=3

--adapter

Database adapter

From config

--adapter=postgresql

--dry-run

Show what would be run

false

--dry-run

azu db seed

Seed database with data.

Option
Description
Default
Example

--file

Seed file

seed.cr

--file=users.cr

--adapter

Database adapter

From config

--adapter=postgresql

--force

Force seeding

false

--force

azu db reset

Reset database (drop, create, migrate, seed).

Option
Description
Default
Example

--adapter

Database adapter

From config

--adapter=postgresql

--skip-seed

Skip seeding

false

--skip-seed

--force

Force reset

false

--force

azu db status

Show migration status.

Option
Description
Default
Example

--adapter

Database adapter

From config

--adapter=postgresql

--format

Output format

table

--format=json

azu db new_migration

Generate new migration.

Option
Description
Default
Example

--table

Table name

Inferred from name

--table=users

--fields

Migration fields

None

--fields=email:string,name:string

--reversible

Make migration reversible

true

--skip-reversible

Development Commands

azu serve

Start development server.

Option
Description
Default
Example

--host

Server host

localhost

--host=0.0.0.0

--port

Server port

4000

--port=8080

--workers

Number of workers

1

--workers=4

--reload

Enable hot reload

false

--reload

--watch

Watch directories

src/

--watch=src/endpoints,src/models

--ssl

Enable SSL

false

--ssl

--ssl-cert

SSL certificate

None

--ssl-cert=cert.pem

--ssl-key

SSL private key

None

--ssl-key=key.pem

--env

Environment

development

--env=production

Examples:

azu dev

Development workflow commands.

azu dev console

Start interactive console.

Option
Description
Default
Example

--env

Environment

development

--env=test

--load

Load specific files

None

--load=src/models/*.cr

azu dev test

Run tests.

Option
Description
Default
Example

--framework

Test framework

spec

--framework=minitest

--pattern

Test pattern

spec/**/*_spec.cr

--pattern=spec/models/*

--parallel

Run tests in parallel

false

--parallel

--coverage

Generate coverage

false

--coverage

--verbose

Verbose output

false

--verbose

azu dev lint

Run linter.

Option
Description
Default
Example

--tool

Linting tool

ameba

--tool=crystal

--rules

Specific rules

All rules

--rules=Style,Performance

--fix

Auto-fix issues

false

--fix

--format

Output format

text

--format=json

azu dev format

Format code.

Option
Description
Default
Example

--check

Check only

false

--check

--files

Specific files

All Crystal files

--files=src/endpoints/*.cr

Configuration Commands

azu config

Configuration management.

azu config show

Show current configuration.

Option
Description
Default
Example

--format

Output format

yaml

--format=json

--env

Environment

Current

--env=production

--section

Specific section

All

--section=database

azu config validate

Validate configuration.

Option
Description
Default
Example

--env

Environment

Current

--env=production

--strict

Strict validation

false

--strict

azu config env

Environment variable management.

Option
Description
Default
Example

--list

List all variables

false

--list

--show

Show current values

false

--show

--set

Set variable

None

--set=AZU_LOG_LEVEL=debug

--unset

Unset variable

None

--unset=AZU_LOG_LEVEL

Utility Commands

azu help

Show help information.

azu version

Show version information.

Option
Description
Default
Example

--format

Output format

text

--format=json

--check

Check for updates

false

--check

Environment Variables

Core Variables

Variable
Description
Default

AZU_CONFIG_PATH

Configuration file path

./azu.yml

AZU_LOG_LEVEL

Log level

info

AZU_ENV

Environment

development

Database Variables

Variable
Description
Default

AZU_DATABASE_URL

Database connection URL

None

AZU_DATABASE_HOST

Database host

localhost

AZU_DATABASE_PORT

Database port

5432

AZU_DATABASE_NAME

Database name

None

AZU_DATABASE_USER

Database username

None

AZU_DATABASE_PASSWORD

Database password

None

Server Variables

Variable
Description
Default

AZU_SERVER_HOST

Server host

localhost

AZU_SERVER_PORT

Server port

4000

AZU_SERVER_WORKERS

Number of workers

1

AZU_SERVER_RELOAD

Enable hot reload

false

Exit Codes

Code
Description

0

Success (EXIT_SUCCESS)

1

General failure (EXIT_FAILURE)

2

Invalid usage/arguments

3

Not found

Examples

Complete Workflow

Advanced Generation

Database Management

Development Workflow

Last updated