forked from mirror/cobra
Better instructions for the execute inside main()
This commit is contained in:
parent
4e18e0c2bf
commit
e22a0c9315
10
README.md
10
README.md
|
@ -156,7 +156,10 @@ package main
|
|||
import "{pathToYourApp}/cmd"
|
||||
|
||||
func main() {
|
||||
RootCmd.Execute()
|
||||
if err := cmd.RootCmd.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -289,7 +292,10 @@ package main
|
|||
import "{pathToYourApp}/cmd"
|
||||
|
||||
func main() {
|
||||
RootCmd.Execute()
|
||||
if err := cmd.RootCmd.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue