Documentation
¶
Overview ¶
Package cli wires commit-spark's command-line surface and orchestrates its commands. All external effects reach it through the injected Git and Codex interfaces, so the command flows are unit-testable with fakes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct {
Version string
Git Git
Codex Codex
// ConfigPath is the absolute path to the config file. ConfigDefaults holds
// the effective defaults (including the OS-detected locale) that a missing
// config key falls back to.
ConfigPath string
ConfigDefaults config.Config
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
// Interactive is true when attached to a TTY (decided once in main).
Interactive bool
// OpenBrowser opens a URL; main wires DefaultOpenBrowser.
OpenBrowser func(ctx context.Context, url string) error
}
App holds every dependency and configuration the commands need.
func (*App) PrintError ¶
PrintError writes err to Stderr. A *apperr.UserError is shown as a single line; any other error additionally gets a version + bug-report footer.
type Git ¶
type Git interface {
RepoRoot(ctx context.Context) (string, error)
StageAll(ctx context.Context) error
StagedDiff(ctx context.Context, excludes []string) (*git.StagedDiff, error)
Commit(ctx context.Context, message string) error
Push(ctx context.Context) error
CurrentBranch(ctx context.Context) (string, error)
RemoteURL(ctx context.Context, name string) (string, error)
DefaultBranch(ctx context.Context) (string, error)
DiffRange(ctx context.Context, rangeSpec string) (string, error)
PushUpstream(ctx context.Context, branch string) error
}
Git is the set of git operations csp needs. *git.Client satisfies it; tests inject a fake.
Click to show internal directories.
Click to hide internal directories.