The Mizu CLI uses specific exit codes to indicate different outcomes. Exit codes are numbers returned when a command finishes - 0 means success, anything else means something went wrong. These codes are essential for shell scripts and CI/CD pipelines that need to know if a command succeeded.
#!/bin/bashset -e # Exit on any error# Create project (exits if fails)mizu new myapp --template api# Or handle specific codesmizu dev || { code=$? case $code in 1) echo "Error occurred" ;; 2) echo "Invalid usage" ;; 3) echo "No project found" ;; *) echo "App exited with code $code" ;; esac exit $code}
# GitHub Actionssteps: - name: Create project run: mizu new myapp --template api # Fails job if exit code != 0 - name: Validate project run: | cd myapp go mod tidy go build ./...
$ mizu unknownerror: unknown command "unknown"Run 'mizu --help' for usage.$ echo $?2$ mizu new myapperror: template is requiredRun 'mizu new --list' to see available templates.$ echo $?2$ mizu dev # in empty directoryerror: no runnable main package found (try --cmd)$ echo $?3