Global flags can be used with any Mizu CLI command. Flags are options you add after a command to change its behavior - like --quiet to reduce output or --json to get machine-readable output for scripts. Global flags can be placed either before or after the subcommand.
Available Flags
| Flag | Short | Type | Description |
|---|
--help | -h | bool | Show help for command |
--quiet | -q | bool | Reduce output (errors only) |
--verbose | -v | bool | Increase verbosity (repeatable) |
--json | | bool | Emit machine-readable JSON output |
--no-color | | bool | Disable color output |
Flag Placement
Global flags can appear before or after the command:
# Before command
mizu --verbose dev
# After command
mizu dev --verbose
# Mixed (both work)
mizu --verbose dev --cmd ./cmd/api
Detailed Reference
--help, -h
Shows help information for the CLI or a specific command.
# Show general help
mizu --help
# Show command-specific help
mizu new --help
mizu dev --help
--quiet, -q
Suppresses normal output, showing only errors. Useful for scripts where you only care about failures.
# Quiet mode - only errors shown
mizu new myapp --template minimal --quiet
# Normal mode
mizu new myapp --template minimal
# Created myapp from template minimal
# 0 directories, 4 files
--quiet is ignored when --json is used, since JSON output mode has its own output format.
--verbose, -v
Increases output verbosity. Can be repeated for more detail.
# Standard verbosity
mizu dev
# Level 1 verbose
mizu dev -v
# discovered main package: ./cmd/api
# Starting ./cmd/api...
# Level 2 verbose (if available)
mizu dev -vv
Verbose output is written to stderr, keeping stdout clean for normal output or piping.
Enables machine-readable JSON output. All commands support this flag.
# JSON output
mizu version --json
{
"success": true,
"data": {
"version": "0.1.0",
"go_version": "go1.24",
"commit": "abc1234",
"built_at": "2024-01-15T10:30:00Z"
}
}
See JSON Output for detailed format documentation.
--no-color
Disables colored output. Useful when:
- Piping output to files
- Running in environments without color support
- Personal preference
# Disable colors
mizu new --list --no-color
# Colors are auto-disabled when not in a terminal
mizu new --list > templates.txt # No colors
Colors are automatically disabled when stdout is not a terminal (e.g., when piping or redirecting).
Flag Combinations
Common Patterns
# Silent execution with JSON errors
mizu new myapp --template api --quiet --json
# Debug mode with verbose output
mizu dev --verbose
# CI/CD friendly
mizu new myapp --template api --json --no-color
# Script-friendly version check
VERSION=$(mizu version --json | jq -r '.data.version')
Conflicting Flags
Some flags override others:
| Combination | Behavior |
|---|
--quiet --verbose | --quiet takes precedence |
--quiet --json | JSON output is not suppressed |
--json --no-color | JSON output (no colors anyway) |
Environment Variables
The CLI also respects these environment variables:
| Variable | Description | Equivalent Flag |
|---|
NO_COLOR | Disable colors when set | --no-color |
TERM=dumb | Disable colors | --no-color |
# Disable colors via environment
NO_COLOR=1 mizu new --list
Examples
Scripting
#!/bin/bash
set -e
# Create project quietly, fail on error
mizu new myapp --template api --quiet
# Get version for logging
VERSION=$(mizu version --json | jq -r '.data.version')
echo "Created with mizu $VERSION"
CI/CD Pipeline
# GitHub Actions example
steps:
- name: Create project
run: |
mizu new myapp --template api --json --no-color > result.json
cat result.json | jq '.success'
Debugging
# Maximum verbosity for troubleshooting
mizu dev -vvv
# Check what would happen
mizu new myapp --template api --dry-run -v
See Also