~technomancy/shevek

f11ca0d603c2bd7d04b4deb4299f1a33b2577614 — Phil Hagelberg 1 year, 8 months ago 34fcfc4
Expand readme; emit usage message.
2 files changed, 23 insertions(+), 4 deletions(-)

M readme.md
M shevek.fnl
M readme.md => readme.md +12 -1
@@ 4,13 4,24 @@

A simple nREPL client.

Shevek should work with
[nREPL servers](https://nrepl.org/nrepl/beyond_clojure.html)
regardless of what language they are implemented in. You can use it to
connect to Clojure servers started by
[Leiningen](https://leiningen.org) but servers for also
[Fennel](https://gitlab.com/technomancy/jeejah) or
[Racket](https://gitlab.org/technomancy/ogion).

It doesn't have fancy features like documentation lookup or
completion, as those tend to not be portable.

## Usage

    $ shevek PORT

## License

Copyright © 2015-2018 Phil Hagelberg
Copyright © 2019 Phil Hagelberg and contributors

Released under the terms of the GNU Lesser General Public License
version 3 or later; see the file LICENSE.

M shevek.fnl => shevek.fnl +11 -3
@@ 50,7 50,10 @@
    (when (contains? response.status :done)
      (tset active-requests response.id nil))
    (when (contains? response.status :needs-input)
      (send-input response.session))))
      (send-input response.session)))
  (when (os.getenv "DEBUG")
    (local view (require :fennelview))
    (print "   " (view response) (view active-requests))))

(λ receive [conn]
  (let [(data err part) (: conn :receive "*a")]


@@ 62,8 65,13 @@
            (print (.. "Decoding error: " d-err (or data part) "\n"))))
      true)))

(local conn (let [port (tonumber (. arg 1))
                  conn (assert (socket.connect "localhost" port))]
(local port (tonumber (. arg 1)))

(when (not port)
  (: io.stderr :write "USAGE: shevek PORT\n")
  (os.exit 1))

(local conn (let [conn (assert (socket.connect "localhost" port))]
              (: conn :settimeout 0.01)
              (send {:op :clone} conn)
              conn))