This commit is contained in:
Michiel Borkent 2020-12-26 14:31:23 +01:00
parent 3dc7c27b17
commit 1d72b006dd
6 changed files with 47 additions and 7 deletions

1
.babashka-pod-90378.port Normal file
View file

@ -0,0 +1 @@
55203

1
.babashka-pod-90569.port Normal file
View file

@ -0,0 +1 @@
55416

1
.babashka-pod-90680.port Normal file
View file

@ -0,0 +1 @@
55557

30
script/lanterna.clj Normal file
View file

@ -0,0 +1,30 @@
(require '[babashka.pods :refer [load-pod]])
(load-pod 'org.babashka/lanterna "0.0.1-SNAPSHOT" {#_#_:force true #_#_:transport :socket})
(require '[pod.babashka.lanterna.terminal :as terminal])
(def terminal (terminal/get-terminal))
(terminal/start terminal)
(terminal/put-string terminal
(str "Hello TUI Babashka!")
10 5)
(terminal/put-string terminal
(str "The size of this terminal: "
(terminal/get-size terminal))
10 6)
(terminal/put-string terminal
"Press q to exit."
10 7)
(terminal/flush terminal)
(def k (terminal/get-key-blocking terminal))
(terminal/put-string terminal
(str "You pressed: " k)
10 8)
(Thread/sleep 1000)

View file

@ -279,13 +279,19 @@
(defn load-pod (defn load-pod
([pod-spec] (load-pod pod-spec nil)) ([pod-spec] (load-pod pod-spec nil))
([pod-spec opts] ([pod-spec opts]
(let [opts (if (string? opts) (let [{:keys [:version :force]} opts
{:version opts} resolved (when (qualified-symbol? pod-spec)
(resolver/resolve pod-spec version force))
_ (prn :resolved resolved)
opts (if resolved
(when-let [extra-opts (:options resolved)]
(merge opts extra-opts)
opts)
opts) opts)
{:keys [:remove-ns :resolve :transport :version :force]} opts {:keys [:remove-ns :resolve :transport]} opts
version (if (string? opts) opts version) _ (prn :opts opts)
pod-spec (cond (string? pod-spec) [pod-spec] pod-spec (cond resolved [(:executable resolved)]
(qualified-symbol? pod-spec) (resolver/resolve pod-spec version force) (string? pod-spec) [pod-spec]
:else pod-spec) :else pod-spec)
pb (ProcessBuilder. ^java.util.List pod-spec) pb (ProcessBuilder. ^java.util.List pod-spec)
socket? (identical? :socket transport) socket? (identical? :socket transport)

View file

@ -182,4 +182,5 @@
(warn (format "Successfully installed pod %s (%s)" qsym version)) (warn (format "Successfully installed pod %s (%s)" qsym version))
(io/file ddir (:artifact/executable artifact))) (io/file ddir (:artifact/executable artifact)))
(io/file ddir (:artifact/executable artifact)))) artifacts)] (io/file ddir (:artifact/executable artifact)))) artifacts)]
[(.getAbsolutePath ^java.io.File (first execs))]))) {:executable (.getAbsolutePath ^java.io.File (first execs))
:options (:pod/options manifest)})))