Print root usage when help called with no args.
This commit is contained in:
		@ -19,10 +19,11 @@ package cobra
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"bytes"
 | 
						"bytes"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	flag "github.com/spf13/pflag"
 | 
					 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						flag "github.com/spf13/pflag"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Command is just that, a command for your application.
 | 
					// Command is just that, a command for your application.
 | 
				
			||||||
@ -137,7 +138,7 @@ func (c *Command) HelpFunc() func(*Command, []string) {
 | 
				
			|||||||
		return func(c *Command, args []string) {
 | 
							return func(c *Command, args []string) {
 | 
				
			||||||
			if len(args) == 0 {
 | 
								if len(args) == 0 {
 | 
				
			||||||
				// Help called without any topic, calling on root
 | 
									// Help called without any topic, calling on root
 | 
				
			||||||
				c.Root().Help()
 | 
									c.Root().Usage()
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user