Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfirmDestructiveOperation ¶
ConfirmDestructiveOperation prompts the user for confirmation before a destructive operation. It returns true if the operation should proceed. The prompt is skipped (returns true) when force is set or agent mode is active.
The read honors ctx cancellation — a Ctrl-C (which the root process wires into ctx via signal.NotifyContext) unblocks the prompt with context.Canceled. Without this, the SIGINT handler would intercept the signal but the bufio read would keep blocking, leaving the user stuck until SIGKILL.
On cancellation the stdin-reader goroutine is leaked (it stays blocked on os.Stdin). That is acceptable: cancellation only happens on the way to process exit, and Go's runtime tears the goroutine down with the process.
func RequireForceInAgentMode ¶ added in v1.19.0
RequireForceInAgentMode refuses an operation that must never ride on agent mode's automatic confirmation. Agent mode normally auto-confirms destructive operations, which is wrong for the few that cannot be undone or that end a session: those need an explicit --force from the caller. It returns nil when force is set or agent mode is off. what names the operation in the error ("dash0 logout"), and hint says how to re-run it.
func SetReaderForTest ¶ added in v1.14.0
SetReaderForTest overrides the confirmation input reader, returning a function that restores the previous reader. It is intended for use only from test code in other packages that need to simulate user input.
Types ¶
This section is empty.