Add Execute func example in README.md (#629)

Trivial addition to the first example in `README.md` that defines the
`cmd.Execute()` function that is referenced further down in the `main.go`
example.
This commit is contained in:
Phillip Johnsen 2018-02-05 23:42:58 +01:00 committed by Eric Paris
parent c2bbfaa12d
commit 93959269ad

View File

@ -192,6 +192,13 @@ var rootCmd = &cobra.Command{
// Do Stuff Here
},
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
```
You will additionally define flags and handle configuration in your init() function.