mmkal / trpc-cli

Turn a tRPC router into a type-safe, fully-functional, documented CLI
Other
49 stars 0 forks source link

Line-by-line logger #4

Closed mmkal closed 1 month ago

mmkal commented 1 month ago

Updated default logger.

Docs (from new readme):

So if the procedure returns ['one', 'two', 'three] this will be written to stdout:

one
two
three

If the procedure returns [{name: 'one'}, {name: 'two'}, {name: 'three'}] this will be written to stdout:

{
  "name": "one"
}
{
  "name": "two"
}
{
  "name": "three"
}

This is to make it as easy as possible to use with other command line tools like xargs, jq etc. via bash-piping. If you don't want to rely on this logging, you can always log inside your procedures however you like and avoid returning a value.