Documentation
¶
Overview ¶
Package cli builds chrome-cdp's cobra command tree and translates every command into the uniform result envelope + exit-code contract.
Index ¶
- Variables
- type App
- func (a *App) Close()
- func (a *App) Execute(args ...string) int
- func (a *App) WithConnector(fn func(ctx context.Context, o ConnOpts) (chrome.Browser, error)) *App
- func (a *App) WithDaemonCtl(start, stop, status func(ConnOpts) (map[string]any, error)) *App
- func (a *App) WithDefaults(d config.Defaults) *App
- func (a *App) WithInput(r io.Reader) *App
- func (a *App) WithStickyTarget(get func(ConnOpts) string, set func(ConnOpts, string) error) *App
- type ConnOpts
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is set at build time via -ldflags.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App carries per-invocation state: the Browser port, output streams, parsed global flags, and the resulting exit code.
func New ¶
New builds an App around a Browser and output streams. The --timeout flag's default is the single source of truth for the timeout (see newRoot).
func (*App) Close ¶
func (a *App) Close()
Close tears down a Browser that this App lazily connected (no-op for an injected Browser, e.g. in tests).
func (*App) WithConnector ¶
WithConnector wires a lazy Browser connector (used by main()); it is invoked only when a command actually needs Chrome.
func (*App) WithDaemonCtl ¶
WithDaemonCtl wires the daemon start/stop/status operations (used by main()).
func (*App) WithDefaults ¶
WithDefaults overrides the built-in flag defaults with values resolved from the config file + environment (used by main()); tests keep the built-ins.