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) 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) Successf(format string, args ...any)
- func (c *Config) Warningf(format string, args ...any)
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
ColorCyan 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
// 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)
}
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, and the config is non-interactive.
func (*Config) IsInteractive ¶
func (*Config) PRLink ¶
PRLink formats a PR number as a clickable, underlined terminal hyperlink. Falls back to plain "#N" when color is disabled.
func (*Config) Repo ¶
func (c *Config) Repo() (repository.Repository, error)
Click to show internal directories.
Click to hide internal directories.