util/prompt: add a default and take default in non-interactive cases

The Tailscale CLI is the primary configuration interface and as such it
is used in scripts, container setups, and many other places that do not
have a terminal available and should not be made to respond to prompts.

The default is set to false where the "risky" API is being used by the
CLI and true otherwise, this means that the `--yes` flags are only
required under interactive runs and scripts do not need to be concerned
with prompts or extra flags.

Updates #19445

Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
James Tucker
2025-09-12 12:33:46 -07:00
committed by James Tucker
parent 442a3a779d
commit b9cdef18c0
5 changed files with 21 additions and 6 deletions
+1 -1
View File
@@ -1086,7 +1086,7 @@ func (e *serveEnv) removeWebServe(sc *ipn.ServeConfig, dnsName string, srvPort u
if len(mounts) > 1 {
msg := fmt.Sprintf("Are you sure you want to delete %d handlers under port %s?", len(mounts), portStr)
if !e.yes && !prompt.YesNo(msg) {
if !e.yes && !prompt.YesNo(msg, true) {
return nil
}
}