diff --git a/fnl/conjure/client/sql/stdio.fnl b/fnl/conjure/client/sql/stdio.fnl index 03adfae3..7b7d1159 100644 --- a/fnl/conjure/client/sql/stdio.fnl +++ b/fnl/conjure/client/sql/stdio.fnl @@ -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]) @@ -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)] @@ -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 @@ -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 " @@ -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]) diff --git a/lua/conjure/client/sql/stdio.lua b/lua/conjure/client/sql/stdio.lua index 891c681d..45ad6f77 100644 --- a/lua/conjure/client/sql/stdio.lua +++ b/lua/conjure/client/sql/stdio.lua @@ -23,7 +23,7 @@ _2amodule_locals_2a["str"] = str _2amodule_locals_2a["text"] = text _2amodule_locals_2a["ts"] = ts _2amodule_locals_2a["_"] = _ -config.merge({client = {sql = {stdio = {command = "psql -U blogger postgres", prompt_pattern = "=> "}}}}) +config.merge({client = {sql = {stdio = {command = "psql postgres://postgres:postgres@localhost/postgres", prompt_pattern = "=> "}}}}) if config["get-in"]({"mapping", "enable_defaults"}) then config.merge({client = {sql = {stdio = {mapping = {start = "cs", stop = "cS", interrupt = "ei"}}}}}) else @@ -90,7 +90,7 @@ local function eval_str(opts) end return a["run!"](display_result, msgs0) end - return repl.send((opts.code .. "\n"), _7_, {["batch?"] = false}) + return repl.send((opts.code .. ";\n"), _7_, {["batch?"] = false}) end return with_repl_or_warn(_6_) end @@ -128,7 +128,7 @@ local function stop() end _2amodule_2a["stop"] = stop local function start() - log.append({(comment_prefix .. "start [] ")}) + log.append({(comment_prefix .. "Strting SQL client...")}) if state("repl") then return log.append({(comment_prefix .. "Can't start, REPL is already running."), (comment_prefix .. "Stop the REPL with " .. config["get-in"]({"mapping", "prefix"}) .. cfg({"mapping", "stop"}))}, {["break?"] = true}) else