Documentation
¶
Overview ¶
Package interactive decides whether Atmos authentication flows may show an interactive prompt (identity selector, MFA token, credential input).
The prompts are rendered with huh, which reads keystrokes from stdin and draws the form on stderr. A prompt is therefore only usable when BOTH streams are terminals. When stderr is captured (for example by the AWS CLI running a credential_process helper) the form is invisible and the process would hang waiting for input nobody can see, so the check must fail closed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Environment ¶
type Environment struct {
// TTY reports which standard streams are terminals. It already honors
// --force-tty / ATMOS_FORCE_TTY when it is the default detector.
TTY term.TTYDetector
// Enabled reports whether interactive mode is enabled (--interactive / ATMOS_INTERACTIVE).
Enabled func() bool
// CI reports whether the process runs in a CI environment.
CI func() bool
}
Environment bundles the inputs of the interactivity decision so tests can inject them without a real terminal.
func Default ¶
func Default() Environment
Default returns the Environment backed by the real terminal, viper, and CI detection.
func (Environment) Available ¶
func (e Environment) Available() bool
Available reports whether interactive prompts can be shown. It requires:
- Interactive mode is enabled (--interactive flag or ATMOS_INTERACTIVE, default true).
- Stdin is a terminal (the prompt reads keystrokes from it).
- Stderr is a terminal (the prompt is drawn on it).
- The process does not run in CI.
Prompts degrade to actionable errors in pipelines, scripts, CI, and when a parent process captures stderr.