aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2022-03-28 11:44:03 -0500
committerAnthony Wang2022-03-28 11:44:03 -0500
commit8d3e071c9e076a038b286520837c5db4212c8e84 (patch)
treeb7a0f347a4b11e6d7ed299c885fbc9ec16cf3ee6
parentbd0ff43d83053edbd0809f8bd9ca3cc2abc687d9 (diff)
Ask for user confirmation before showing val
-rw-r--r--sd.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/sd.go b/sd.go
index ac1d46d..d1a6756 100644
--- a/sd.go
+++ b/sd.go
@@ -97,10 +97,13 @@ func main() {
var key, val string
db.QueryRow("SELECT key, val FROM cards WHERE idx=?", i).Scan(&key, &val)
fmt.Println(key)
+
+ // Wait for confirmation
+ var b []byte = make([]byte, 1)
+ os.Stdin.Read(b)
fmt.Println(val)
// Read user input
- var b []byte = make([]byte, 1)
os.Stdin.Read(b)
if b[0] == byte('y') {
w >>= 1