MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / confirm

Function confirm

utils/logger.py:104–122  ·  view source on GitHub ↗

Keep asking until we get a real y or n — never auto-cancel.

(question)

Source from the content-addressed store, hash-verified

102 console.rule(style="dim")
103
104def confirm(question) -> bool:
105 """Keep asking until we get a real y or n — never auto-cancel."""
106 sys.stdout.flush()
107 sys.stderr.flush()
108 while True:
109 try:
110 ans = console.input(f"\n⚠ {question} [y/N]: ").strip().lower()
111 if ans in ("y", "yes"):
112 return True
113 if ans in ("n", "no", ""):
114 # Only accept empty as No if it was a deliberate Enter
115 # Re-prompt if stdin might have leftover newlines
116 return False
117 except EOFError:
118 # stdin closed (e.g. piped input) — default to False
119 return False
120 except KeyboardInterrupt:
121 print()
122 return False

Callers

nothing calls this directly

Calls 1

flushMethod · 0.80

Tested by

no test coverage detected