~aleteoryx/tclfeed-bsky

ref: 45b4726bb4064d001f09b40b8ecf6a82b6c55ec1 tclfeed-bsky/lib/prompt.tcl -rw-r--r-- 627 bytes
45b4726bAleteoryx more heuristic tweaks 25 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
proc input {message varname {default {}}} {
  upvar $varname input
  set input {}
  puts $message
  while {$input == {}} {
    puts -nonewline "% "
    flush stdout
    gets stdin input
    if {$input == {}} {set input $default}
  }
  puts ""
}

proc inopt {message varname} {
  upvar $varname input
  set input {}
  puts $message
  puts -nonewline "% "
  flush stdout
  gets stdin input
  puts ""
}

proc paswd {message varname} {
  upvar $varname input
  set input {}
  puts $message
  exec stty -echo
  while {$input == {}} {
    puts -nonewline "% "
    flush stdout
    gets stdin input
  }
  exec stty echo
  puts "\n"
}