adds accidental removal of section back
This commit is contained in:
		
							
								
								
									
										26
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								README.md
									
									
									
									
									
								
							@ -471,6 +471,32 @@ Cobra also has functions where the return signature is an error. This allows for
 | 
				
			|||||||
**Example Usage using RunE:**
 | 
					**Example Usage using RunE:**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```go
 | 
					```go
 | 
				
			||||||
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"errors"
 | 
				
			||||||
 | 
						"log"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/spf13/cobra"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func main() {
 | 
				
			||||||
 | 
						var rootCmd = &cobra.Command{
 | 
				
			||||||
 | 
							Use:   "hugo",
 | 
				
			||||||
 | 
							Short: "Hugo is a very fast static site generator",
 | 
				
			||||||
 | 
							Long: `A Fast and Flexible Static Site Generator built with
 | 
				
			||||||
 | 
					                love by spf13 and friends in Go.
 | 
				
			||||||
 | 
					                Complete documentation is available at http://hugo.spf13.com`,
 | 
				
			||||||
 | 
							RunE: func(cmd *cobra.Command, args []string) error {
 | 
				
			||||||
 | 
								// Do Stuff Here
 | 
				
			||||||
 | 
								return errors.New("some random error")
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if err := rootCmd.Execute(); err != nil {
 | 
				
			||||||
 | 
							log.Fatal(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Suggestions when "unknown command" happens
 | 
					## Suggestions when "unknown command" happens
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user