luvcraft/tools/lobby.lisp
in-package#:luvcraft.tools
defunread-stdin-value
Everything on stdin, minus one trailing newline.
defuncommand-lobby
arguments
let
verb
firstarguments
rest
restarguments
flet
one-key
unless
firstrest
cond
nullverb
command-line-error"lobby expects get|put|rm|ls|host."
string=verb"host"
formatt"~A:~D~%"
mqtt.net:lobby-host
mqtt.net:*lobby-port*string=verb"ls"
loopfor
key.value
insort
domqtt.net:lobby-keys
#'string<:key#'carstring=verb"get"
let
value
mqtt.net:lobby-get
one-key
:default:absentwrite-stringvalue
terpri
string=verb"put"
unless
command-line-error"lobby put expects KEY [VALUE]; without VALUE it reads stdin."
let
value
when
zerop
lengthvalue
command-line-error"Refusing to store an empty value; use lobby rm to delete."
mqtt.net:lobby-put
firstrest
valuestring=verb"rm"
mqtt.net:lobby-delete
one-key
formatt"deleted ~A~%"
firstrest
t
define-arithmetic-operator =
Test whether two compatible scalars are equal.
defun command-lobby
(arguments)define-arithmetic-operator <=
Test whether one compatible scalar is at most another.
luv lobby: the tailnet value store from the shell.
`luv lobby put OPENAI_API_KEY` reads the value from stdin so secrets stay out of shell history; `luv lobby get KEY` prints it for $(...) use.