Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hituziando/pp-go
Pretty print command written in Go.
https://github.com/hituziando/pp-go
go json pretty-print
Last synced: about 2 months ago
JSON representation
Pretty print command written in Go.
- Host: GitHub
- URL: https://github.com/hituziando/pp-go
- Owner: HituziANDO
- License: mit
- Created: 2020-11-19T06:34:31.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-13T05:03:51.000Z (almost 2 years ago)
- Last Synced: 2024-06-21T01:51:21.707Z (7 months ago)
- Topics: go, json, pretty-print
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pp-go
`ppgo` is pretty print command written in Go.
## Usage
### JSON Parse
```shell script
ppgo '{"key1":"val1","key2":"val2","arr":[101,202,303,404]}'
```Output:
```json
{
"arr": [
101,
202,
303,
404
],
"key1": "val1",
"key2": "val2"
}
```---
As other usage,Pipeline:
```shell script
less test.json | ppgo
````-file` option:
```shell script
ppgo -file=test.json
```### Options
The `ppgo` command has some options.
|Option|Explanation|default|
|:-:|:-:|:-:|
|file|Input JSON file.||
|indent|The number of space to indent.|2|For example:
```shell script
ppgo -indent=4 '{"key1":"val1","key2":"val2"}'
``````shell script
less test.json | ppgo -indent=4
``````shell script
ppgo -file=test.json -indent=4
```To show help, run following command.
```shell script
ppgo -h
```## Get Started
```shell script
go mod init pp-go
```## Build
To make the `ppgo` command, run following command. Then add `path/to/bin` to your $PATH.
```
go build -o ./bin/ppgo
```## Test
To test, run `go test`.
```
go test -v
```