vendor: github.com/urfave/cli v1.22.9
The regression in v1.22.2 has been resolved, so we can drop the replace rule and use the latest v1.22.x version. full diff: https://github.com/urfave/cli/compare/v1.22.1...v1.22.9 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
		
							
								
								
									
										55
									
								
								vendor/github.com/urfave/cli/help.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										55
									
								
								vendor/github.com/urfave/cli/help.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -47,13 +47,18 @@ type helpPrinter func(w io.Writer, templ string, data interface{}) | ||||
| // Prints help for the App or Command with custom template function. | ||||
| type helpPrinterCustom func(w io.Writer, templ string, data interface{}, customFunc map[string]interface{}) | ||||
|  | ||||
| // HelpPrinter is a function that writes the help output. If not set a default | ||||
| // is used. The function signature is: | ||||
| // func(w io.Writer, templ string, data interface{}) | ||||
| // HelpPrinter is a function that writes the help output. If not set explicitly, | ||||
| // this calls HelpPrinterCustom using only the default template functions. | ||||
| // | ||||
| // If custom logic for printing help is required, this function can be | ||||
| // overridden. If the ExtraInfo field is defined on an App, this function | ||||
| // should not be modified, as HelpPrinterCustom will be used directly in order | ||||
| // to capture the extra information. | ||||
| var HelpPrinter helpPrinter = printHelp | ||||
|  | ||||
| // HelpPrinterCustom is same as HelpPrinter but | ||||
| // takes a custom function for template function map. | ||||
| // HelpPrinterCustom is a function that writes the help output. It is used as | ||||
| // the default implementation of HelpPrinter, and may be called directly if | ||||
| // the ExtraInfo field is set on an App. | ||||
| var HelpPrinterCustom helpPrinterCustom = printHelpCustom | ||||
|  | ||||
| // VersionPrinter prints the version for the App | ||||
| @@ -66,20 +71,24 @@ func ShowAppHelpAndExit(c *Context, exitCode int) { | ||||
| } | ||||
|  | ||||
| // ShowAppHelp is an action that displays the help. | ||||
| func ShowAppHelp(c *Context) (err error) { | ||||
| 	if c.App.CustomAppHelpTemplate == "" { | ||||
| 		HelpPrinter(c.App.Writer, AppHelpTemplate, c.App) | ||||
| 		return | ||||
| func ShowAppHelp(c *Context) error { | ||||
| 	template := c.App.CustomAppHelpTemplate | ||||
| 	if template == "" { | ||||
| 		template = AppHelpTemplate | ||||
| 	} | ||||
|  | ||||
| 	if c.App.ExtraInfo == nil { | ||||
| 		HelpPrinter(c.App.Writer, template, c.App) | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	customAppData := func() map[string]interface{} { | ||||
| 		if c.App.ExtraInfo == nil { | ||||
| 			return nil | ||||
| 		} | ||||
| 		return map[string]interface{}{ | ||||
| 			"ExtraInfo": c.App.ExtraInfo, | ||||
| 		} | ||||
| 	} | ||||
| 	HelpPrinterCustom(c.App.Writer, c.App.CustomAppHelpTemplate, c.App, customAppData()) | ||||
| 	HelpPrinterCustom(c.App.Writer, template, c.App, customAppData()) | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| @@ -186,11 +195,13 @@ func ShowCommandHelp(ctx *Context, command string) error { | ||||
|  | ||||
| 	for _, c := range ctx.App.Commands { | ||||
| 		if c.HasName(command) { | ||||
| 			if c.CustomHelpTemplate != "" { | ||||
| 				HelpPrinterCustom(ctx.App.Writer, c.CustomHelpTemplate, c, nil) | ||||
| 			} else { | ||||
| 				HelpPrinter(ctx.App.Writer, CommandHelpTemplate, c) | ||||
| 			templ := c.CustomHelpTemplate | ||||
| 			if templ == "" { | ||||
| 				templ = CommandHelpTemplate | ||||
| 			} | ||||
|  | ||||
| 			HelpPrinter(ctx.App.Writer, templ, c) | ||||
|  | ||||
| 			return nil | ||||
| 		} | ||||
| 	} | ||||
| @@ -238,11 +249,15 @@ func ShowCommandCompletions(ctx *Context, command string) { | ||||
|  | ||||
| } | ||||
|  | ||||
| func printHelpCustom(out io.Writer, templ string, data interface{}, customFunc map[string]interface{}) { | ||||
| // printHelpCustom is the default implementation of HelpPrinterCustom. | ||||
| // | ||||
| // The customFuncs map will be combined with a default template.FuncMap to | ||||
| // allow using arbitrary functions in template rendering. | ||||
| func printHelpCustom(out io.Writer, templ string, data interface{}, customFuncs map[string]interface{}) { | ||||
| 	funcMap := template.FuncMap{ | ||||
| 		"join": strings.Join, | ||||
| 	} | ||||
| 	for key, value := range customFunc { | ||||
| 	for key, value := range customFuncs { | ||||
| 		funcMap[key] = value | ||||
| 	} | ||||
|  | ||||
| @@ -261,7 +276,7 @@ func printHelpCustom(out io.Writer, templ string, data interface{}, customFunc m | ||||
| } | ||||
|  | ||||
| func printHelp(out io.Writer, templ string, data interface{}) { | ||||
| 	printHelpCustom(out, templ, data, nil) | ||||
| 	HelpPrinterCustom(out, templ, data, nil) | ||||
| } | ||||
|  | ||||
| func checkVersion(c *Context) bool { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sebastiaan van Stijn
					Sebastiaan van Stijn