Documentation
¶
Index ¶
- type Config
- func (c *Config) Errorf(format string, args ...any)
- func (c *Config) GitHubClient() (ghapi.ClientOps, error)
- func (c *Config) Infof(format string, args ...any)
- func (c *Config) IsInteractive() bool
- func (c *Config) Link(label, url string) string
- func (c *Config) Outf(format string, args ...any)
- func (c *Config) PRLink(number int, url string) string
- func (c *Config) Printf(format string, args ...any)
- func (c *Config) Repo() (repository.Repository, error)
- func (c *Config) StackLink(number int) string
- func (c *Config) StackURL(number int) string
- func (c *Config) Successf(format string, args ...any)
- func (c *Config) TerminalLink(label, url string) string
- func (c *Config) Warningf(format string, args ...any)
- type StackMutationContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Terminal term.Term
Out *os.File
Err *os.File
In *os.File
ColorSuccess func(string) string
ColorError func(string) string
ColorWarning func(string) string
ColorBold func(string) string
ColorBlue func(string) string
ColorMagenta func(string) string
ColorAccent func(string) string
ColorGray func(string) string
// GitHubClientOverride, when non-nil, is returned by GitHubClient()
// instead of creating a real client. Used in tests to inject a MockClient.
GitHubClientOverride ghapi.ClientOps
// ForceInteractive, when true, makes IsInteractive() return true
// regardless of the terminal state. Used in tests.
ForceInteractive bool
// NonInteractive suppresses prompts even when stdout is a terminal.
NonInteractive bool
// Canceled records explicit user cancellation even when a command returns ErrSilent.
Canceled bool
// WorktreePathOnly makes checkout resolution skip imports for foreign owners.
WorktreePathOnly bool
// StackMutation is command-lifetime coordination, never persisted.
StackMutation *StackMutationContext
// SelectFn, when non-nil, is called instead of prompting via the
// terminal. Used in tests to simulate interactive selection.
SelectFn func(prompt, defaultValue string, options []string) (int, error)
// ConfirmFn, when non-nil, is called instead of prompting via the
// terminal. Used in tests to simulate yes/no confirmation prompts.
ConfirmFn func(prompt string, defaultValue bool) (bool, error)
// InputFn, when non-nil, is called instead of prompting via the
// terminal. Used in tests to simulate text input prompts.
InputFn func(prompt string) (string, error)
// RepoOverride, when non-nil, is returned by Repo() instead of
// calling repository.Current(). Used in tests to avoid depending on
// the real git repo context.
RepoOverride *repository.Repository
}
Config holds shared state for all commands.
func New ¶
func New() *Config
New creates a new Config with terminal-aware output and color support.
func NewTestConfig ¶
NewTestConfig creates a Config suitable for testing with captured output buffers. Color functions are no-ops, GitHub calls are stubbed, and the config is non-interactive.
func (*Config) IsInteractive ¶
func (*Config) Link ¶ added in v0.3.0
Link formats a reference with a terminal hyperlink or a copyable URL fallback.
func (*Config) PRLink ¶
PRLink formats a PR number as a clickable terminal hyperlink when supported, or includes the full URL as a copyable fallback.
func (*Config) Repo ¶
func (c *Config) Repo() (repository.Repository, error)
func (*Config) StackLink ¶ added in v0.3.0
StackLink formats a stack number using the same conventions as PRLink.
func (*Config) StackURL ¶ added in v0.3.0
StackURL returns no destination when optional display identity is unavailable. Formatting a reference must not turn an otherwise successful command into an error.
func (*Config) TerminalLink ¶ added in v0.3.0
TerminalLink keeps a compact label when terminal hyperlinks are unavailable. Use Link's raw underline codes; per-rune TUI underlining can corrupt OSC 8.