updated help

This commit is contained in:
Mike Farah 2015-09-29 11:05:28 +10:00
parent 4ea8d5c4ee
commit 2a0290aeac

14
yaml.go
View File

@ -19,13 +19,13 @@ func main() {
{ {
Name: "read", Name: "read",
Aliases: []string{"r"}, Aliases: []string{"r"},
Usage: "read <filename> <path>\n\te.g.: yaml read sample.json a.b.c\n\t(default) reads a property from a given yaml file", Usage: "read <filename> <path>\n\te.g.: yaml read sample.json a.b.c\n\t(default) reads a property from a given yaml file\n",
Action: readProperty, Action: readProperty,
}, },
{ {
Name: "write", Name: "write",
Aliases: []string{"w"}, Aliases: []string{"w"},
Usage: "write <filename> <path> <value>\n\te.g.: yaml write sample.json a.b.c 5\n\tupdates a property from a given yaml file, outputs to stdout", Usage: "write <filename> <path> <value>\n\te.g.: yaml write sample.json a.b.c 5\n\tupdates a property from a given yaml file, outputs to stdout\n",
Action: writeProperty, Action: writeProperty,
}, },
} }
@ -56,11 +56,11 @@ func writeProperty(c *cli.Context) {
} }
func printYaml(context interface{}) { func printYaml(context interface{}) {
out, err := yaml.Marshal(context) out, err := yaml.Marshal(context)
if err != nil { if err != nil {
log.Fatalf("error printing yaml: %v", err) log.Fatalf("error printing yaml: %v", err)
} }
fmt.Println(string(out)) fmt.Println(string(out))
} }
func readYaml(c *cli.Context, parsedData *map[interface{}]interface{}) { func readYaml(c *cli.Context, parsedData *map[interface{}]interface{}) {