Skip to content

Commit

Permalink
Default the psql command to something generic and append a ; to eac…
Browse files Browse the repository at this point in the history
…h evaluation
  • Loading branch information
Olical committed May 31, 2024
1 parent 2d63424 commit 9346878
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions fnl/conjure/client/sql/stdio.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
{:client
{:sql
{:stdio
{:command "psql -U blogger postgres"
{:command "psql postgres://postgres:postgres@localhost/postgres"
:prompt_pattern "=> "}}}})

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

(def buf-suffix ".sql")
(def comment-prefix "-- ")

;; Rough equivalent of a Lisp form.
(defn form-node? [node]
(or (= "statement" (node:type))))

;; Comment nodes are comment (--) and marginalia (/*...*/)
(defn comment-node? [node]
(or (= "comment" (node:type))
(= "marginalia" (node:type))
))
(= "marginalia" (node:type))))

(defn- with-repl-or-warn [f opts]
(let [repl (state :repl)]
Expand Down Expand Up @@ -82,7 +83,7 @@
(with-repl-or-warn
(fn [repl]
(repl.send
(.. opts.code "\n")
(.. opts.code ";\n")
(fn [msgs]
(let [msgs (->list msgs)]
(when opts.on-result
Expand Down Expand Up @@ -116,7 +117,7 @@
(a.assoc (state) :repl nil))))

(defn start []
(log.append [(.. comment-prefix "start [] ")])
(log.append [(.. comment-prefix "Strting SQL client...")])
(if (state :repl)
(log.append [(.. comment-prefix "Can't start, REPL is already running.")
(.. comment-prefix "Stop the REPL with "
Expand Down Expand Up @@ -148,8 +149,7 @@

:on-stray-output
(fn [msg]
(display-result msg))
})))))
(display-result msg))})))))

(defn on-load []
(when (config.get-in [:client_on_load])
Expand Down
6 changes: 3 additions & 3 deletions lua/conjure/client/sql/stdio.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9346878

Please sign in to comment.