1
0
Fork 0
forked from fun/fun

Added input_hidden() to ask for passwords in the CLI without echoing the chars. (0.37.37)

This commit is contained in:
Johannes Findeisen 2026-01-02 20:12:01 +01:00
commit b32f7e839b
7 changed files with 172 additions and 4 deletions

View file

@ -17,6 +17,15 @@ class Console()
else
return input(join([q, ": "], ""))
// Ask for a secret string (e.g., password) without echoing input
// Returns the entered string. A trailing newline is not echoed back.
fun ask_hidden(this, question)
q = to_string(question)
if (len(q) == 0)
return input_hidden("")
else
return input_hidden(join([q, ": "], ""))
// Ask a yes/no question; returns 1 for yes, 0 for no
// Accepts: y, yes, n, no (case-insensitive). Keeps asking until valid.
fun ask_yes_no(this, question)