mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
Better instructions for the execute inside main()
This commit is contained in:
parent
4e18e0c2bf
commit
e22a0c9315
1 changed files with 8 additions and 2 deletions
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 a new issue