aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/urfave/cli.v1/help.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-01-11 02:33:17 +0800
committerFelix Lange <fjl@twurst.com>2017-01-11 05:33:24 +0800
commitd78f9b834ade0f1ebcf2532bf90d01c85ad50a8e (patch)
treedd03906433e1032a0b185910773206246d8a1556 /vendor/gopkg.in/urfave/cli.v1/help.go
parent02b67558e8eaa7b34a28b8dd0223824bbbb52349 (diff)
downloadgo-tangerine-d78f9b834ade0f1ebcf2532bf90d01c85ad50a8e.tar
go-tangerine-d78f9b834ade0f1ebcf2532bf90d01c85ad50a8e.tar.gz
go-tangerine-d78f9b834ade0f1ebcf2532bf90d01c85ad50a8e.tar.bz2
go-tangerine-d78f9b834ade0f1ebcf2532bf90d01c85ad50a8e.tar.lz
go-tangerine-d78f9b834ade0f1ebcf2532bf90d01c85ad50a8e.tar.xz
go-tangerine-d78f9b834ade0f1ebcf2532bf90d01c85ad50a8e.tar.zst
go-tangerine-d78f9b834ade0f1ebcf2532bf90d01c85ad50a8e.zip
vendor: update all dependencies except Azure SDK
The Azure SDK doesn't support Go 1.5 anymore. We can't upgrade it until Go 1.8 comes out.
Diffstat (limited to 'vendor/gopkg.in/urfave/cli.v1/help.go')
-rw-r--r--vendor/gopkg.in/urfave/cli.v1/help.go73
1 files changed, 50 insertions, 23 deletions
diff --git a/vendor/gopkg.in/urfave/cli.v1/help.go b/vendor/gopkg.in/urfave/cli.v1/help.go
index 0f4cf14cd..c8c1aee05 100644
--- a/vendor/gopkg.in/urfave/cli.v1/help.go
+++ b/vendor/gopkg.in/urfave/cli.v1/help.go
@@ -13,27 +13,31 @@ import (
// cli.go uses text/template to render templates. You can
// render custom help text by setting this variable.
var AppHelpTemplate = `NAME:
- {{.Name}} - {{.Usage}}
+ {{.Name}}{{if .Usage}} - {{.Usage}}{{end}}
USAGE:
- {{if .UsageText}}{{.UsageText}}{{else}}{{.HelpName}} {{if .VisibleFlags}}[global options]{{end}}{{if .Commands}} command [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}{{end}}
- {{if .Version}}{{if not .HideVersion}}
+ {{if .UsageText}}{{.UsageText}}{{else}}{{.HelpName}} {{if .VisibleFlags}}[global options]{{end}}{{if .Commands}} command [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}{{end}}{{if .Version}}{{if not .HideVersion}}
+
VERSION:
- {{.Version}}
- {{end}}{{end}}{{if len .Authors}}
-AUTHOR(S):
- {{range .Authors}}{{.}}{{end}}
- {{end}}{{if .VisibleCommands}}
+ {{.Version}}{{end}}{{end}}{{if .Description}}
+
+DESCRIPTION:
+ {{.Description}}{{end}}{{if len .Authors}}
+
+AUTHOR{{with $length := len .Authors}}{{if ne 1 $length}}S{{end}}{{end}}:
+ {{range $index, $author := .Authors}}{{if $index}}
+ {{end}}{{$author}}{{end}}{{end}}{{if .VisibleCommands}}
+
COMMANDS:{{range .VisibleCategories}}{{if .Name}}
{{.Name}}:{{end}}{{range .VisibleCommands}}
- {{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}
-{{end}}{{end}}{{if .VisibleFlags}}
+ {{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{end}}{{end}}{{if .VisibleFlags}}
+
GLOBAL OPTIONS:
- {{range .VisibleFlags}}{{.}}
- {{end}}{{end}}{{if .Copyright}}
+ {{range $index, $option := .VisibleFlags}}{{if $index}}
+ {{end}}{{$option}}{{end}}{{end}}{{if .Copyright}}
+
COPYRIGHT:
- {{.Copyright}}
- {{end}}
+ {{.Copyright}}{{end}}
`
// CommandHelpTemplate is the text template for the command help topic.
@@ -240,7 +244,7 @@ func checkCommandHelp(c *Context, name string) bool {
}
func checkSubcommandHelp(c *Context) bool {
- if c.GlobalBool("h") || c.GlobalBool("help") {
+ if c.Bool("h") || c.Bool("help") {
ShowSubcommandHelp(c)
return true
}
@@ -248,20 +252,43 @@ func checkSubcommandHelp(c *Context) bool {
return false
}
+func checkShellCompleteFlag(a *App, arguments []string) (bool, []string) {
+ if !a.EnableBashCompletion {
+ return false, arguments
+ }
+
+ pos := len(arguments) - 1
+ lastArg := arguments[pos]
+
+ if lastArg != "--"+BashCompletionFlag.Name {
+ return false, arguments
+ }
+
+ return true, arguments[:pos]
+}
+
func checkCompletions(c *Context) bool {
- if (c.GlobalBool(BashCompletionFlag.Name) || c.Bool(BashCompletionFlag.Name)) && c.App.EnableBashCompletion {
- ShowCompletions(c)
- return true
+ if !c.shellComplete {
+ return false
}
- return false
+ if args := c.Args(); args.Present() {
+ name := args.First()
+ if cmd := c.App.Command(name); cmd != nil {
+ // let the command handle the completion
+ return false
+ }
+ }
+
+ ShowCompletions(c)
+ return true
}
func checkCommandCompletions(c *Context, name string) bool {
- if c.Bool(BashCompletionFlag.Name) && c.App.EnableBashCompletion {
- ShowCommandCompletions(c, name)
- return true
+ if !c.shellComplete {
+ return false
}
- return false
+ ShowCommandCompletions(c, name)
+ return true
}