[bisq-network/bisq] API CLI output formatting that is unix-idiomatic and machine-friendly (#4348)

dmos62 notifications at github.com
Tue Jul 7 16:32:03 UTC 2020


Above thinking led me to a human-unfriendly format, but @ghubstan pointed out that some of us will want to use the API interactively (as in calling it from a terminal emulator, see [0] for term definition). That leads to a bit more compllicated output logic where you can choose between either a human-optimized or a machine-optimized output.

The simplest solution I see is to have the machine-optimized output as outlined above, but have an optional post-processing step (in terms of implementation) that would make the output more terse, merging multiple simple columns into one complex column, and thus more human friendly.

So you'd have something close to this for a human `Price in USD for 1 BTC|BTC(min - max)|USD(min - max)` and something closer to this `Price|Base currency|Minimum base currency quantity|Maximum base currency quantity|Quote currency|Minimum quote currency quantity|Maximum quote currency quantity` for a machine.

The "post-processing step" part is important, because it's the fact that the human friendly version is a derivative of the simple, machine-friendly version that makes the implementation simple (no duplicated logic).

### Another alternative to keep in mind

Another option is to use a headerless table format, which is common amongst unix tools (like `mount` or `git remote -v`). It puts keys and values on the same row, which often makes the table easier to read (rows look more like terse sentences than rows in a table) and makes it easy to query with very basic parsing:

```
> mount | grep "type cgroup" | grep "cpu"
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
```

Supporting both a headered table and a headerless table would be simple enough, but we'll only investigate adopting it if the headered table format described earlier is not human friendly enough.

[0] https://unix.stackexchange.com/questions/43385/what-do-you-mean-by-interactive-shell


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/issues/4348#issuecomment-654980296
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20200707/b09d2326/attachment.html>


More information about the bisq-github mailing list