Skip to content

Commit

Permalink
Update lanterna example
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Oct 14, 2020
1 parent 834bd05 commit e20f5f2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 3 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"feature-yaml" "feature-csv" "feature-transit"
"feature-java-time" "feature-java-nio"
"feature-httpkit-client" "feature-httpkit-server"
"feature-lanterna"
"sci/src" "babashka.curl/src" "babashka.pods/src"
"babashka.nrepl/src"
"depstar/src"
Expand All @@ -23,7 +24,8 @@
org.postgresql/postgresql {:mvn/version "42.2.12"}
org.hsqldb/hsqldb {:mvn/version "2.4.0"}
datascript/datascript {:mvn/version "0.18.11"}
http-kit/http-kit {:mvn/version "2.5.0"}}
http-kit/http-kit {:mvn/version "2.5.0"}
babashka/clojure-lanterna {:mvn/version "0.9.8-SNAPSHOT"}}
:aliases {:main
{:main-opts ["-m" "babashka.main"]}
:profile
Expand Down
2 changes: 1 addition & 1 deletion doc/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Example program:
``` clojure
(require '[lanterna.terminal :as terminal])

(def terminal (terminal/text-terminal))
(def terminal (terminal/get-terminal))

(terminal/start terminal)
(terminal/put-string terminal "Hello TUI Babashka!" 10 5)
Expand Down
11 changes: 5 additions & 6 deletions feature-lanterna/babashka/impl/lanterna.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
[lanterna.constants]
[lanterna.screen]
[lanterna.terminal]
[sci.impl.namespaces :refer [copy-var]]
[sci.impl.vars :as vars]))
[sci.core :as sci :refer [copy-var]]))

(def tns (vars/->SciNamespace 'lanterna.terminal nil))
(def sns (vars/->SciNamespace 'lanterna.screen nil))
(def cns (vars/->SciNamespace 'lanterna.screen nil))
(def tns (sci/create-ns 'lanterna.terminal nil))
(def sns (sci/create-ns 'lanterna.screen nil))
(def cns (sci/create-ns 'lanterna.screen nil))

(def lanterna-terminal-namespace
{'add-resize-listener (copy-var lanterna.terminal/add-resize-listener tns)
'remove-resize-listener (copy-var lanterna.terminal/remove-resize-listener tns)
'text-terminal (copy-var lanterna.terminal/text-terminal tns)
'get-terminal (copy-var lanterna.terminal/get-terminal tns)
'start (copy-var lanterna.terminal/start tns)
'stop (copy-var lanterna.terminal/stop tns)
'get-size (copy-var lanterna.terminal/get-size tns)
Expand Down

0 comments on commit e20f5f2

Please sign in to comment.