Documentation
¶
Index ¶
- Variables
- func APIToken2ZoneID() string
- func Execute() error
- func RegisterCompletionFlags()
- func SetBuildInfo(version, buildTime, gitCommit string)
- type AnalyticsResult
- type AuthCredentials
- type BatchOperation
- type BatchSpec
- type BucketSpec
- type BucketSpecItem
- type BucketStat
- type CompareDiff
- type CompareResult
- type OutputResponse
- type Presenter
- func (p *Presenter) Error(format string, args ...any) error
- func (p *Presenter) ErrorWrap(msg string, err error) error
- func (p *Presenter) IsJSON() bool
- func (p *Presenter) Result(data any, human func()) error
- func (p *Presenter) Success(message string, data any) error
- func (p *Presenter) SuccessPayload(message string, json func() any, human func()) error
- type SSLStatusSection
- type StatusReport
- type StatusSection
Constants ¶
This section is empty.
Variables ¶
var ( AppVersion = "dev" BuildTime = "unknown" GitCommit = "unknown" AccountID string APIToken string DryRun bool JSONOutput bool Verbose bool // EnvProfile holds the --env flag value: the named environment profile // selected for this invocation (does not change the current profile). EnvProfile string // ActiveProfile is the resolved --env profile for this invocation, or // nil when no --env was given. Other commands read it via the // accessor semantics of this package-level variable (FEAT-026). ActiveProfile *config.Profile )
Build information
Functions ¶
func APIToken2ZoneID ¶ added in v0.31.0
func APIToken2ZoneID() string
APIToken2ZoneID keeps the zone ID dependency explicit for the seam var above without new global state.
func Execute ¶
func Execute() error
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func RegisterCompletionFlags ¶
func RegisterCompletionFlags()
RegisterCompletionFlags sets up dynamic shell completions for commands that accept bucket names as positional arguments.
func SetBuildInfo ¶
func SetBuildInfo(version, buildTime, gitCommit string)
SetBuildInfo sets the build information
Types ¶
type AnalyticsResult ¶
type AnalyticsResult struct {
Buckets []BucketStat `json:"buckets"`
Total BucketStat `json:"total"`
Period string `json:"period"`
}
type AuthCredentials ¶
type BatchOperation ¶
type BatchSpec ¶
type BatchSpec struct {
Operations []BatchOperation `json:"operations"`
}
type BucketSpec ¶
type BucketSpec struct {
Buckets []BucketSpecItem `json:"buckets" yaml:"buckets"`
}
type BucketSpecItem ¶
type BucketStat ¶
type CompareDiff ¶
type CompareResult ¶
type CompareResult struct {
OnlyInSource []string `json:"only_in_source"`
OnlyInDest []string `json:"only_in_dest"`
DifferentSize []CompareDiff `json:"different_size"`
Same []string `json:"same"`
}
type OutputResponse ¶
type OutputResponse struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
Data interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
}
OutputResponse represents a standard response format
type Presenter ¶ added in v0.28.2
type Presenter struct {
// contains filtered or unexported fields
}
Presenter renders command output in the active output mode (FEAT-040).
It exists to collapse the per-command `if JSONOutput { ... } else { ... }` duplication (618 sites at audit time) into one unconditional call per concern. Commands build one presenter per run and call Error/Result without branching on the mode themselves.
Contracts preserved from the legacy branches:
- Error (plain): returns a formatted error — the command exits non-zero.
- Error (JSON): prints the standard error envelope and returns printErrorJSON's result (nil when the print succeeds — the historical exit-0-in-JSON-mode behavior; changing that is a separate decision).
- Result (JSON): marshals data; the human renderer is NEVER invoked in JSON mode so tables never pollute machine-readable stdout.
func NewPresenter ¶ added in v0.28.2
func NewPresenter() *Presenter
NewPresenter captures the output mode at construction time. Construct it after flag parsing (inside RunE), not at init time.
func (*Presenter) ErrorWrap ¶ added in v0.28.2
ErrorWrap renders a wrapped upstream error (the `%w` legacy shape) in the active mode: "msg: err" both ways, %w-preserved for errors.Is/As in plain mode.
func (*Presenter) IsJSON ¶ added in v0.28.2
IsJSON reports whether the presenter runs in machine mode.
func (*Presenter) Result ¶ added in v0.28.2
Result renders a success payload: data marshalled in JSON mode, the human renderer invoked in plain mode. Returns the print error, if any.
func (*Presenter) Success ¶ added in v0.28.2
Success renders a human success message, or the standard success envelope in JSON mode.
func (*Presenter) SuccessPayload ¶ added in v0.28.2
SuccessPayload collapses the shaped-payload species: the json closure builds the command's typed output and is invoked ONLY in JSON mode (the standard success envelope wraps it); the human renderer runs ONLY in plain mode. Both closures stay at the call site, the mode branch lives here — once.
type SSLStatusSection ¶
type StatusReport ¶
type StatusReport struct {
Timestamp string `json:"timestamp"`
AccountID string `json:"account_id"`
Zones StatusSection `json:"zones"`
Workers StatusSection `json:"workers"`
KV StatusSection `json:"kv_namespaces"`
Buckets StatusSection `json:"r2_buckets"`
DNS StatusSection `json:"dns_records"`
SSL SSLStatusSection `json:"ssl"`
QueryTimeMs int64 `json:"query_time_ms"`
Errors []string `json:"errors,omitempty"`
}
type StatusSection ¶
Source Files
¶
- account.go
- account_audit.go
- account_members.go
- ai.go
- alerts.go
- alerts_push.go
- alerts_watch.go
- analytics.go
- apply.go
- audit.go
- audit_wire.go
- auth.go
- auth_permissions.go
- backup.go
- bucket.go
- bucket_domain.go
- bucket_lifecycle.go
- bucket_notifications.go
- bucket_policy.go
- cache.go
- compare.go
- completion.go
- config.go
- copy.go
- cors.go
- cost.go
- create.go
- d1.go
- d1_export.go
- d1_import.go
- d1_local.go
- d1_migrations.go
- d1_parity.go
- d1_push.go
- d1_timetravel.go
- dashboard.go
- decode.go
- delete.go
- demo.go
- destructive.go
- dev.go
- diff.go
- dns.go
- doctor.go
- domains.go
- domains_get.go
- domains_ns.go
- domains_redirects.go
- domains_registrar.go
- domains_stats.go
- domains_tui.go
- dryrun_wire.go
- durable_objects.go
- email.go
- envscope.go
- export.go
- firewall.go
- hyperdrive.go
- images.go
- import_cmd.go
- init.go
- knowledge_cmd.go
- kv.go
- limits.go
- list.go
- loadbalancer.go
- logpush.go
- mcp.go
- mcp_generate.go
- metrics.go
- migrate.go
- object.go
- output.go
- pagerules.go
- pages.go
- pages_deploy_verify.go
- pages_deployment.go
- pages_domain.go
- pages_env.go
- pageshield.go
- plugin.go
- prefixed_args.go
- queue.go
- queue_dlq.go
- queue_send.go
- ratelimit.go
- redirects.go
- root.go
- serve.go
- setup.go
- spectrum.go
- ssl.go
- ssl_custom_hostnames.go
- status.go
- stream.go
- switch.go
- sync.go
- templates.go
- terraform.go
- theme.go
- tunnel.go
- turnstile.go
- validate.go
- vectorize.go
- waf.go
- waf_lists.go
- waf_ratelimit.go
- waitingroom.go
- watch.go
- webanalytics.go
- worker.go
- worker_bindings.go
- worker_cron.go
- worker_deployments.go
- worker_domains.go
- worker_routes.go
- worker_secrets.go
- worker_subdomain.go
- worker_tail.go
- worker_types.go
- worker_versions.go
- wrangler.go
- zone.go