Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExitCodeForError ¶
ExitCodeForError maps error types to process exit codes:
- nil or CancelError -> 0
- FlagError or NotFoundError -> 2
- RateLimitError -> 5
- everything else -> 1
func OpenBrowser ¶ added in v0.4.0
OpenBrowser opens the given URL in the user's default browser. It uses "open" on macOS, "xdg-open" on Linux, and "cmd /c start" on Windows.
Types ¶
type CancelError ¶
type CancelError struct {
Err error
}
CancelError indicates a user-initiated cancellation (e.g., answering "no" to a confirmation prompt). The process exits 0 with no error output.
func (CancelError) Error ¶
func (e CancelError) Error() string
func (CancelError) Unwrap ¶
func (e CancelError) Unwrap() error
type Factory ¶
type Factory struct {
// AppVersion is the binary version string, injected at build time via ldflags.
AppVersion string
// Config returns the parsed application configuration.
Config func() (config.Config, error)
// HTTPClient returns a configured KeeperHub HTTP client for API requests.
// The client automatically injects version headers and per-host credentials.
HTTPClient func() (*khhttp.Client, error)
// IOStreams provides the standard input/output streams.
IOStreams *iostreams.IOStreams
}
Factory is the dependency injection container passed to every command. Commands receive a *Factory and call its func fields to obtain dependencies lazily; this allows tests to inject mocks without a full runtime setup.
type FlagError ¶
type FlagError struct {
Err error
}
FlagError indicates an invalid or missing CLI flag value. The error message is printed without a stack trace and the process exits 2.
type NotFoundError ¶
type NotFoundError struct {
Err error
}
NotFoundError wraps a 404 response. Exit code: 2.
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
func (NotFoundError) Unwrap ¶
func (e NotFoundError) Unwrap() error
type RateLimitError ¶
RateLimitError wraps a 429 response. Exit code: 5.
func (RateLimitError) Error ¶
func (e RateLimitError) Error() string
func (RateLimitError) Unwrap ¶
func (e RateLimitError) Unwrap() error
type SilentError ¶
type SilentError struct {
Err error
}
SilentError signals that the error message has already been printed and the process should exit non-zero without printing anything further.
func (SilentError) Error ¶
func (e SilentError) Error() string
func (SilentError) Unwrap ¶
func (e SilentError) Unwrap() error