https://github.com/hituziando/pp-go
Pretty print command written in Go.
https://github.com/hituziando/pp-go
go json pretty-print
Last synced: 4 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 5 years ago)
- Default Branch: main
- Last Pushed: 2023-02-13T05:03:51.000Z (almost 3 years ago)
- Last Synced: 2025-03-14T06:14:10.403Z (11 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
```