init
This commit is contained in:
commit
7ab5bcbe4a
14
LICENSE
Normal file
14
LICENSE
Normal file
@ -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.
|
||||
|
34
main.go
Normal file
34
main.go
Normal file
@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
|
||||
b, err := ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "problem reading stdin: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
var obj interface{}
|
||||
err = yaml.Unmarshal(b, &obj)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "issue in decoding: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
bs, err := yaml.Marshal(obj)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "issue in encoding: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
r := bytes.NewReader(bs)
|
||||
io.Copy(os.Stdout, r)
|
||||
}
|
Loading…
Reference in New Issue
Block a user