sm
/
jsoon
1
0
Fork 0
Esse commit está contido em:
Stephen McQuay 2015-04-12 22:38:13 -07:00
commit 01c5c905eb
3 arquivos alterados com 46 adições e 0 exclusões

14
LICENSE Normal file
Ver arquivo

@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

10
README.md Normal file
Ver arquivo

@ -0,0 +1,10 @@
jsoon
=====
Simple util for to be `python -mjson.tool` replacement. The second in my series
of small go programs to implement/replace cool tools I use frequently.
"jsoon" because it takes a json stream and expands it. Seriously, look at the
code; you'd have to really try hard to make a simpler program.
There are officially more letters in this readme at this point, actually.

22
main.go Normal file
Ver arquivo

@ -0,0 +1,22 @@
package main
import (
"bytes"
"encoding/json"
"io/ioutil"
"log"
"os"
)
func main() {
b, err := ioutil.ReadAll(os.Stdin)
if err != nil {
log.Fatal("problem reading stdin", err)
}
var out bytes.Buffer
err = json.Indent(&out, b, "", "\t")
if err != nil {
log.Fatal(err)
}
out.WriteTo(os.Stdout)
}