Skip to main content

Module cli

Module cli 

Source
Expand description

CLI dispatch entry point.

Two-stage error model so the frozen exit codes from IMPLEMENTATION.md §7.1 are deterministic regardless of which step fails:

  1. Config stage ([load_and_resolve_config]) — parse the YAML, validate it, resolve the api-key environment variable. Any failure here, including a missing or unreadable config file, exits with code 3 (config / argument error).
  2. Dispatch stage ([dispatch]) — run the requested subcommand. Errors are mapped through [exit_code_for], which walks the anyhow::Error chain and downcasts to the typed errors that carry semantic meaning (BrazeApiError, Error).

exit_code_for deliberately walks the entire chain so an error wrapped as Error::Api(BrazeApiError::Unauthorized) and a bare BrazeApiError::Unauthorized map to the same exit code (4). This matters because ? from braze API methods produces the latter while some library helpers might produce the former in the future.

Modules§

apply
braze-sync apply — the only command that mutates remote state.
diff
braze-sync diff — show drift between local files and Braze.
export
braze-sync export — pull current state from Braze into local files.
init
braze-sync init — scaffold a new braze-sync workspace.
validate
braze-sync validate — local-only structural and naming checks.

Structs§

Cli

Enums§

Command

Functions§

run
Top-level CLI entry point. Returns the process exit code per IMPLEMENTATION.md §7.1.