Nicely formats output

This commit is contained in:
Mike Farah 2015-09-29 10:56:12 +10:00
parent 5a3c3a7152
commit eebd319246

10
yaml.go
View File

@ -34,7 +34,15 @@ func readProperty(c *cli.Context) {
var path = c.Args()[1] var path = c.Args()[1]
var paths = strings.Split(path, ".") var paths = strings.Split(path, ".")
fmt.Println(readMap(parsedData, paths[0], paths[1:len(paths)])) printYaml(readMap(parsedData, paths[0], paths[1:len(paths)]))
}
func printYaml(context interface{}) {
out, err := yaml.Marshal(context)
if err != nil {
log.Fatalf("error printing yaml: %v", err)
}
fmt.Println(string(out))
} }
func readYaml(c *cli.Context, parsedData *map[interface{}]interface{}) { func readYaml(c *cli.Context, parsedData *map[interface{}]interface{}) {