项目作者: acidnik

项目描述 :
Detect, highlight and pretty print structured data inside plain-text
高级语言: Rust
项目地址: git://github.com/acidnik/kras-rs.git
创建时间: 2020-07-08T19:39:56Z
项目社区:https://github.com/acidnik/kras-rs

开源协议:MIT License

下载


kras

kras - Detect, highlight and pretty print structured data

This tool can find structured data of any kind inside of plain string, parse it and pretty-print it:

It can detect and parse almost any kind of data:

  • json
  • python
  • rust

and probably many more. Don’t hesitate to open an issue if your data wasn’t processed correctly

Installation

  1. cargo install kras-rs

Usage

  1. Usage: kras [OPTIONS] [INPUT]...
  2. Arguments:
  3. [INPUT]... Input files or stdin
  4. Options:
  5. -i, --indent <INDENT> identation. 0 to disable (colorization is still performed) [default: 2]
  6. -c, --color <COLOR> colorize output [default: auto] [possible values: auto, yes, no]
  7. -C, --force-color alias for --color yes
  8. -s, --sort sort keys
  9. -r, --recursive try to parse nested strings
  10. -j, --jobs <JOBS> number of parallel jobs. Default is num_cpus
  11. -w, --width <WIDTH> maximum width of output [default: 80]
  12. -m, --multiline look for data spannding several lines. This will read wholle input to memory
  13. --robust use more robust, but slower method to detect structured data
  14. --debug debut mode
  15. -h, --help Print help
  16. -V, --version Print version

Using with pgcli

kras really shines when used for reading jsons stored in database. For pgcli add to your .config/pgcli/config

  1. pager = kras -Csw120 | less -iRXF

Now your jsons will be pretty-printed! Hint: use \x

Acknowledgement

This tool is powered by these amazing libs: pom for parsing and pretty for pretty-printing

Trivia

The name kras comes from russian root крас- - a beginning of words such as красивый (pretty), красный (red) and красить (to paint).
That’s what this app does: makes data pretty and paints it red (but not only red)