           (cond
             (= 10 pressed) (do
                              (clear-list! num-opts)
-                             (prompt-select-list question choices selected true false))
+                             (prompt-check-list question choices selected true false))
+
+            (= 32 pressed) (let [new-choices (map-indexed (fn [i opt]
+                                                            (if (= i selected)
+                                                              (assoc opt :checked (not (get opt :checked false)))
+                                                              opt)) choices)]
+                             (clear-list! num-opts)
+                             (prompt-check-list question new-choices selected false false))
 
             (= 27 pressed) (let [next (.readCharacter term System/in)]
                              (if (= 91 next)

  (let [term (Terminal/getTerminal)]
    (print (esc/cursor-hide))
    (if (= true submitted?)
      (let [opt-selected (nth choices selected nil)
            opt-selected-label (get opt-selected :label)
            opt-selected-val (get opt-selected :value)]
        (.restoreTerminal term)
        (print (esc/cursor-show))
        (println (str "[" (c/green "▸") "] " question ": " (c/cyan opt-selected-label)))
        opt-selected-val)

      (let [num-opts (count choices)
            tip (if (= true first-rendering?) (c/dim " (UP/DOWN move, SPACE check/uncheck, ENTER submit)") "")]

(ns pretty.cli.prompt
  (:require [pretty.cli.colors :as c]
            [pretty.cli.ansi-escapes :as esc]
            [schema.core :as s]
            [clojure.string :as str])
  (:import [jline Terminal]))

(s/defschema CHOICE {(s/required-key :label) (s/constrained s/Str #(not (clojure.string/blank? %)))
