Changes
1 changed files (+5/-1)
-
-
@@ -16,12 +16,15 @@ file := arglet conn ← SQLite.FFI.connect file SQLite.FFI.Constants.SQLITE_OPEN_READWRITE -- Number of cards + 1 let n := (← do match ← conn.prepare "SELECT COUNT(*) FROM cards" with | .ok c => _ ← c.step c.columnInt 0 | .error e => panic e).toNatClampNeg + 1 -- The DB is one-indexed -- Get card weights let mut A := (← do match ← conn.prepare "SELECT weight FROM cards" with | .ok c =>
-
@@ -39,6 +42,7 @@ if verbose thenIO.println A.toList if !backend then -- Disable input buffering _ ← IO.Process.run { cmd := "stty" args := #["-F", "/dev/tty", "cbreak", "min", "1"]
-
@@ -64,7 +68,6 @@ c.bindInt64 1 i.toNat.toInt64_ ← c.step IO.println s!"> {← c.columnText 0}" if backend then -- TODO: This flush isn't working _ ← stdout.flush let b ← stdin.read 1 if b = "q".bytes then
-
@@ -96,6 +99,7 @@ c.bindInt64 2 i.toNat.toInt64_ ← c.step | .error e => panic e -- Cleanup if !backend then _ ← IO.Process.run { cmd := "stty"
-