restate icon indicating copy to clipboard operation
restate copied to clipboard

[CLI] Universal --output option for all get/list/describe commands

Open peterbourgon opened this issue 2 months ago • 0 comments

A common use case for CLI tools like restate is to take the output from one subcommand (like restate inv ls), pipe it thru some grep or column-selecting filters, and then into the stdin of another subcommand (like restate inv cancel) to effect some change.

For example in docker I've done stuff like:

docker images -a | rg '(weeks|months|years) ago' | coln 3 | xargs docker rmi

Similarly, in restate I often want to do stuff like e.g.

restate inv list | rg backing-off | coln 3 | xargs restate inv cancel

But right now restate inv list returns output like e.g.

  ❯ [2025-10-07 15:35:18.572 +02:00] inv_10xxx
     Target:      MyObject/1234567/Execute
     Status:      running  (5 seconds and 157 ms)
     Deployment:  dp_12xxx

  ❯ [2025-10-07 15:35:17.126 +02:00] inv_10yyy
     Target:      MyService/9876543/Method
     Status:      running  (6 seconds and 604 ms)
     Deployment:  dp_12yyy

which isn't feasible to work with in a shell pipeline. It would be great for there to be some way to get that as a "plain" table like e.g.

INVOCATION_ID   TARGET                     STATUS    DEPLOYMENT_ID   DURATION_SEC
inv_10xxx       MyObject/1234567/Execute   running   dp_12xxx        5.157
inv_10yyy       MyService/9876543/Method   running   dp_12yyy        6.604

or even JSONL would be fine as well, e.g.

{"invocation_id":"inv_10xxx","target":"MyObject/1234567/Execute","status":"running","deployment_id":"dp_12xxx","duration_sec":5.157}
{"invocation_id":"inv_10yyy","target":"MyService/9876543/Method","status":"running","deployment_id":"dp_12yyy","duration_sec":6.604}

Ideally this would be controlled via a consistent --output option for all get/ls/desc/etc. subcommands e.g.

  --output OUTPUT    output format: plaintable (default), bordertable, humanlist, json, jsonl

ref: https://github.com/restatedev/restate/issues/3867

peterbourgon avatar Oct 07 '25 13:10 peterbourgon