cmd

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 28 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRootCommand

func NewRootCommand(deps Dependencies) *cobra.Command

Types

type APIClient

type APIClient interface {
	ListRecords(ctx context.Context, domain, recordType string) ([]api.Record, error)
	CreateRecord(ctx context.Context, domain string, input api.RecordInput) (*api.Record, error)
	UpdateRecord(ctx context.Context, domain, id string, input api.RecordInput) (*api.Record, error)
	DeleteRecord(ctx context.Context, domain, id string) (*api.Record, error)
	ListMailboxes(ctx context.Context, domain string) ([]api.Mailbox, error)
	ListForwardings(ctx context.Context, domain string) ([]api.Forwarding, error)
	GetSecrets(ctx context.Context, project, env, deployment, format string) (*api.SecretsResult, error)
	GetAuthStatus(ctx context.Context) (*api.AuthStatus, error)
	ListWebSites(ctx context.Context, zone, server, host string) ([]api.WebSite, error)
	CreateWebURI(ctx context.Context, zone, server string, fields map[string]string, dryRun bool) (*api.WebResult, error)
	UpdateWebURI(ctx context.Context, zone, server, id string, fields map[string]string, dryRun bool) (*api.WebResult, error)
	DeleteWebURI(ctx context.Context, zone, server, id string, dryRun bool) (*api.WebResult, error)
	RestoreWebURI(ctx context.Context, zone, server, id string) (*api.WebResult, error)
	ListWebServers(ctx context.Context) ([]api.WebServer, error)
	ListWebBuckets(ctx context.Context) ([]api.WebBucket, error)
	GetWebOptions(ctx context.Context, zone, server, host string) (*api.WebOptions, error)
	SetWebOptions(ctx context.Context, zone, server, host string, options map[string]any, dryRun bool) (*api.WebOptions, error)
}

APIClient is the subset of *api.Client the domain, mailbox, forwarding, and (in a later task) project commands depend on. Tests inject a fake implementation; production code resolves a real *api.Client lazily.

type Dependencies

type Dependencies struct {
	Out, Err   io.Writer
	Store      credentials.Store
	Env        func(string) string
	ReadSecret func(prompt string) (string, error)

	// API, when set, is used instead of resolving a real *api.Client from
	// stored credentials. Left nil in production so credential resolution
	// stays lazy: it happens inside each domain/mailbox/forwarding
	// command's RunE (see resolveAPI in domain.go), never here, so that
	// credential-free commands like "auth login" keep working with zero
	// stored credentials.
	API APIClient
	// BaseURL is the Dymmer API base URL; defaults to
	// "https://dymmer.com/api/v1" when empty.
	BaseURL string
	// IsTerminal reports whether stdin is an interactive terminal; used to
	// decide whether a destructive command may prompt for confirmation.
	IsTerminal func() bool
	// Confirm prompts the user with a yes/no question and reports the
	// answer. It defaults to a real stderr/stdin prompt (internal/confirm).
	Confirm func(prompt string) (bool, error)
	// ExtensionsFile, when non-empty, is used directly as the path to the
	// user-defined extensions.yaml (see ext.go), bypassing the
	// --extensions-file flag/DYM_EXTENSIONS_FILE env var/default-location
	// resolution entirely. Left empty in production; tests set it directly
	// to point at a scratch file rather than faking env vars or flags.
	ExtensionsFile string

	// Pair, RunDaemon and Inventory are what `dym auth daemon` and `dym daemon` use to talk to Dymmer and to read the
	// host. Nil in production (the real ones); tests give their own so that nothing connects anywhere.
	Pair      PairFunc
	RunDaemon RunDaemonFunc
	Inventory func() daemon.Inventory
}

type PairFunc added in v0.12.0

type PairFunc func(ctx context.Context, o daemon.PairOptions) (daemon.State, error)

PairFunc pairs this host with Dymmer; tests replace it.

type RunDaemonFunc added in v0.12.0

type RunDaemonFunc func(ctx context.Context, o daemon.RunOptions) error

RunDaemonFunc keeps this host connected to Dymmer until ctx ends; tests replace it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL