aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin
diff options
context:
space:
mode:
authorIsaac Freund <mail@isaacfreund.com>2025-12-02 10:19:00 +0100
committerCalvin Rose <calsrose@gmail.com>2025-12-02 09:13:18 -0600
commit7d55ba691f37610bb7485b63413a854d26f08fca (patch)
tree5c4e20228c3530a2c2ef93eaa5346256d8e09142 /bin
parentCI: Add 1.39.1 and remove 1.35.2 testing (diff)
netrepl: allow specifying unix socket on CLI
Currently it is impossible to connect to or create a unix socket netrepl server using the janet-netrepl CLI tool. It is however easy and useful to create a unix socket based server using the (netrepl/server) function directly. This patch adds a new --unix-socket/-U <PATH> option that overrides any host/port specified and connects to/creates a server at the given path.
Diffstat (limited to 'bin')
-rw-r--r--bin/janet-netrepl10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/janet-netrepl b/bin/janet-netrepl
index 46cb673..f71cde2 100644
--- a/bin/janet-netrepl
+++ b/bin/janet-netrepl
@@ -26,6 +26,11 @@
:default netrepl/default-port
:kind :option}
+ "unix-socket"
+ {:short "U"
+ :help (string "Unix socket path to serve the repl at.")
+ :kind :option}
+
"client"
{:short "c"
:kind :flag
@@ -63,8 +68,9 @@
# Break on help text
(unless ap (break))
- (def host (ap "host"))
- (def port (ap "port"))
+ (def [host port] (if-let [path (ap "unix-socket")]
+ [:unix path]
+ [(ap "host") (ap "port")]))
(def dof (ap "dofile"))
(def msg (ap "message"))
(def msg-file (ap "message-file"))