Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -1,18 +1,19 @@
|
|||
val choose = impure fn(entries) {
|
||||
val choose = fn*(entries) {
|
||||
if entries is not list: throw "invalid args"
|
||||
if not entries: return ""
|
||||
|
||||
# print the menu
|
||||
writeln join("\n", map(fn e, i: "{{i:2}}: {{e}}", entries, 1..len(entries)))
|
||||
writeln join(map(entries, 1..len(entries), by=fn e, i:"{{i:2}}: {{e}}"), by="\n")
|
||||
|
||||
val idx = read(
|
||||
"Select entry #: ",
|
||||
fn(x) {
|
||||
prompt="Select entry #: ",
|
||||
validation=fn(x) {
|
||||
if not x -> RE/^[0-9]+$/: return false
|
||||
val y = x -> number
|
||||
y > 0 and y <= len(entries)
|
||||
},
|
||||
"invalid selection\n", -1,
|
||||
errmsg="invalid selection\n",
|
||||
maxattempts=-1,
|
||||
) -> number
|
||||
|
||||
entries[idx]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue