Skip to content

Commit 9346878

Browse files
committed
Default the psql command to something generic and append a ; to each evaluation
1 parent 2d63424 commit 9346878

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

fnl/conjure/client/sql/stdio.fnl

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
{:client
3030
{:sql
3131
{:stdio
32-
{:command "psql -U blogger postgres"
32+
{:command "psql postgres://postgres:postgres@localhost/postgres"
3333
:prompt_pattern "=> "}}}})
3434

3535
(when (config.get-in [:mapping :enable_defaults])
@@ -47,14 +47,15 @@
4747

4848
(def buf-suffix ".sql")
4949
(def comment-prefix "-- ")
50+
5051
;; Rough equivalent of a Lisp form.
5152
(defn form-node? [node]
5253
(or (= "statement" (node:type))))
54+
5355
;; Comment nodes are comment (--) and marginalia (/*...*/)
5456
(defn comment-node? [node]
5557
(or (= "comment" (node:type))
56-
(= "marginalia" (node:type))
57-
))
58+
(= "marginalia" (node:type))))
5859

5960
(defn- with-repl-or-warn [f opts]
6061
(let [repl (state :repl)]
@@ -82,7 +83,7 @@
8283
(with-repl-or-warn
8384
(fn [repl]
8485
(repl.send
85-
(.. opts.code "\n")
86+
(.. opts.code ";\n")
8687
(fn [msgs]
8788
(let [msgs (->list msgs)]
8889
(when opts.on-result
@@ -116,7 +117,7 @@
116117
(a.assoc (state) :repl nil))))
117118

118119
(defn start []
119-
(log.append [(.. comment-prefix "start [] ")])
120+
(log.append [(.. comment-prefix "Strting SQL client...")])
120121
(if (state :repl)
121122
(log.append [(.. comment-prefix "Can't start, REPL is already running.")
122123
(.. comment-prefix "Stop the REPL with "
@@ -148,8 +149,7 @@
148149

149150
:on-stray-output
150151
(fn [msg]
151-
(display-result msg))
152-
})))))
152+
(display-result msg))})))))
153153

154154
(defn on-load []
155155
(when (config.get-in [:client_on_load])

lua/conjure/client/sql/stdio.lua

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)