alda-lang/alda

Add some API to get information about all running REPL servers

UlyssesZh opened this issue · 2 comments

I hope there is an API provided by the alda command to print a list of running REPL servers, including the information like ports and working directories. Sometimes there are multiple REPL servers running simultaneously, which are hard to track. Although they write .alda-nrepl-port files to tell us the ports, the obvious drawbacks are that this mechanism is ineffective when multiple servers run in the same directory or when we lose track of the working directories. Since there is a convenient alda ps command, I hope a similar command exists to provide similar API for REPL servers.

I've been thinking about adding Alda REPL servers to the alda ps output. Maybe we can add a type column, to differentiate between players and REPL servers, something like this:

id  port  status expiry             type
esd 38461 ready  5 minutes from now player
pnr 33955 ready  7 minutes from now player
kwh 44013 -      -                  repl-server
tzr 36053 ready  6 minutes from now player

@UlyssesZh I've just released Alda 2.0.3, which includes Alda REPL servers in the alda ps output. For example:

$ alda ps | column -t -s $'\t'
id   port   state   expiry              type
itv  33659  ready   5 minutes from now  player
lhx  36583  active  5 minutes from now  player
olt  34539  ready   5 minutes from now  player
utj  40235  ready   5 minutes from now  player
yae  35935  ready   7 minutes from now  player
zew  40425  ready   6 minutes from now  player
itp  33643  -       -                   repl-server
jom  34191  -       -                   repl-server

$ grep repl-server <(alda ps)
itp     33643   -       -       repl-server
jom     34191   -       -       repl-server

$ grep player <(alda ps)
itv  33659  ready   5 minutes from now  player
lhx  36583  active  5 minutes from now  player
olt  34539  ready   5 minutes from now  player
utj  40235  ready   5 minutes from now  player
yae  35935  ready   7 minutes from now  player
zew  40425  ready   6 minutes from now  player