Documentation
¶
Overview ¶
Package state persists the sticky "current target" across CLI invocations, keyed per browser endpoint, under $XDG_STATE_HOME.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateSession ¶ added in v0.3.0
ValidateSession reports whether name is a well-formed session namespace. An empty name means "no session" and is valid, the same way browser.ValidateEndpoint treats an empty --endpoint as unset — so a caller can validate the flag/env/config value unconditionally without special- casing "not given".
It is a pure function (no filesystem, no Chrome) so it can run in PersistentPreRunE ahead of resolveTarget/getBrowser (a malformed --session is usage/exit 2 before anything connects) and, exported for exactly this, in internal/config's applyFile/applyEnv, where a malformed CHROME_CDP_SESSION or TOML session is dropped silently like a malformed endpoint is.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds per-endpoint CLI state under an XDG state directory.
func New ¶
New returns a Store rooted at $XDG_STATE_HOME/chrome-cdp (or ~/.local/state), keyed by an endpoint identity (e.g. host:port of the debug endpoint) so distinct Chrome instances don't share a sticky target.
func (*Store) CurrentTarget ¶
CurrentTarget returns the sticky target spec, or "" if none is set.
func (*Store) SetCurrentTarget ¶
SetCurrentTarget persists the sticky target spec.