5 个不稳定版本

0.7.0 2021 年 9 月 24 日
0.6.0 2021 年 9 月 20 日
0.5.3 2021 年 9 月 12 日
0.5.2 2021 年 9 月 9 日
0.5.1 2021 年 9 月 7 日

#24#format-json

MIT 许可证

37KB
939

📺 tv

将 JSON 格式化为表格视图

如何安装

对于 MacOS

$ brew install uzimaru0000/tap/tv

使用 cargo

$ cargo install tv-cli

如何使用

用法

tv [FLAGS] [OPTIONS] [PATH]

标志

-h, --help          Prints help information
    --no-headers    Specify that the input has no header row
-r, --recursive     Recursive display
-V, --version       Prints version information

选项

-a, --align <left | center | right | none>                  Table alignment [default: none]
-s, --sort <SORT_KEY>                                       Options for sorting by key
    --style <ascii | sharp | rounded | markdown | plain>    Table style [default: ascii]

参数

<PATH>    json file path

示例

$ cat example.json
[
  {
    "id": 1,
    "name": "Leanne Graham",
    "username": "Bret",
    "email": "[email protected]",
    "address": {
      "street": "Kulas Light",
      "suite": "Apt. 556",
      "city": "Gwenborough",
      "zipcode": "92998-3874",
      "geo": {
        "lat": "-37.3159",
        "lng": "81.1496"
      }
    },
    "phone": "1-770-736-8031 x56442",
    "website": "hildegard.org",
    "company": {
      "name": "Romaguera-Crona",
      "catchPhrase": "Multi-layered client-server neural-net",
      "bs": "harness real-time e-markets"
    }
  },
  ...
]

$ tv example.json
+--+------------------------+----------------+-------------------------+-------+---------------------+-------------+-------+
|id|name                    |username        |email                    |address|phone                |website      |company|
+--+------------------------+----------------+-------------------------+-------+---------------------+-------------+-------+
|1 |Leanne Graham           |Bret            |[email protected]        |...    |1-770-736-8031 x56442|hildegard.org|...    |
|2 |Ervin Howell            |Antonette       |[email protected]        |...    |010-692-6593 x09125  |anastasia.net|...    |
|3 |Clementine Bauch        |Samantha        |[email protected]       |...    |1-463-123-4447       |ramiro.info  |...    |
|4 |Patricia Lebsack        |Karianne        |[email protected]|...    |493-170-9623 x156    |kale.biz     |...    |
|5 |Chelsey Dietrich        |Kamren          |[email protected] |...    |(254)954-1289        |demarco.info |...    |
|6 |Mrs. Dennis Schulist    |Leopoldo_Corkery|[email protected]  |...    |1-477-935-8478 x6430 |ola.org      |...    |
|7 |Kurtis Weissnat         |Elwyn.Skiles    |[email protected]   |...    |210.067.6132         |elvis.io     |...    |
|8 |Nicholas Runolfsdottir V|Maxime_Nienow   |[email protected]     |...    |586.493.6943 x140    |jacynthe.com |...    |
|9 |Glenna Reichert         |Delphine        |[email protected]  |...    |(775)976-6794 x41206 |conrad.com   |...    |
|10|Clementina DuBuque      |Moriah.Stanton  |[email protected]   |...    |024-648-3804         |ambrose.net  |...    |
+--+------------------------+----------------+-------------------------+-------+---------------------+-------------+-------+

依赖项

~6–13MB
~123K SLoC