mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-03 04:27:21 -05:00
d5058b3b20
update go min version Update Vendors: * code.gitea.io/gitea-vet v0.2.0 -> v0.2.1 * code.gitea.io/sdk/gitea v0.13.0 -> v0.13.1 * github.com/AlecAivazis/survey v2.1.1 -> v2.2.2 * github.com/adrg/xdg v0.2.1 -> v0.2.2 * github.com/araddon/dateparse d820a6159ab1 -> 8aadafed4dc4 * github.com/go-git/go-git v5.1.0 -> v5.2.0 * github.com/muesli/termenv v0.7.2 -> v0.7.4 * github.com/stretchr/testify v1.5.1 -> v1.6.1 * github.com/urfave/cli v2.2.0 -> v2.3.0 Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/250 Reviewed-by: Andrew Thornton <art27@cantab.net> Reviewed-by: mrsdizzie <info@mrsdizzie.com> Co-Authored-By: 6543 <6543@noreply.gitea.io> Co-Committed-By: 6543 <6543@noreply.gitea.io>
121 lines
3.7 KiB
Go
121 lines
3.7 KiB
Go
package cli
|
|
|
|
// AppHelpTemplate is the text template for the Default help topic.
|
|
// cli.go uses text/template to render templates. You can
|
|
// render custom help text by setting this variable.
|
|
var AppHelpTemplate = `NAME:
|
|
{{.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}}
|
|
|
|
VERSION:
|
|
{{.Version}}{{end}}{{end}}{{if .Description}}
|
|
|
|
DESCRIPTION:
|
|
{{.Description | nindent 3 | trim}}{{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}}:{{range .VisibleCommands}}
|
|
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{else}}{{range .VisibleCommands}}
|
|
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{end}}{{end}}{{end}}{{if .VisibleFlags}}
|
|
|
|
GLOBAL OPTIONS:
|
|
{{range $index, $option := .VisibleFlags}}{{if $index}}
|
|
{{end}}{{$option}}{{end}}{{end}}{{if .Copyright}}
|
|
|
|
COPYRIGHT:
|
|
{{.Copyright}}{{end}}
|
|
`
|
|
|
|
// CommandHelpTemplate is the text template for the command help topic.
|
|
// cli.go uses text/template to render templates. You can
|
|
// render custom help text by setting this variable.
|
|
var CommandHelpTemplate = `NAME:
|
|
{{.HelpName}} - {{.Usage}}
|
|
|
|
USAGE:
|
|
{{if .UsageText}}{{.UsageText}}{{else}}{{.HelpName}}{{if .VisibleFlags}} [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}{{end}}{{if .Category}}
|
|
|
|
CATEGORY:
|
|
{{.Category}}{{end}}{{if .Description}}
|
|
|
|
DESCRIPTION:
|
|
{{.Description | nindent 3 | trim}}{{end}}{{if .VisibleFlags}}
|
|
|
|
OPTIONS:
|
|
{{range .VisibleFlags}}{{.}}
|
|
{{end}}{{end}}
|
|
`
|
|
|
|
// SubcommandHelpTemplate is the text template for the subcommand help topic.
|
|
// cli.go uses text/template to render templates. You can
|
|
// render custom help text by setting this variable.
|
|
var SubcommandHelpTemplate = `NAME:
|
|
{{.HelpName}} - {{.Usage}}
|
|
|
|
USAGE:
|
|
{{if .UsageText}}{{.UsageText}}{{else}}{{.HelpName}} command{{if .VisibleFlags}} [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}{{end}}{{if .Description}}
|
|
|
|
DESCRIPTION:
|
|
{{.Description | nindent 3 | trim}}{{end}}
|
|
|
|
COMMANDS:{{range .VisibleCategories}}{{if .Name}}
|
|
{{.Name}}:{{range .VisibleCommands}}
|
|
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{else}}{{range .VisibleCommands}}
|
|
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{end}}{{end}}{{if .VisibleFlags}}
|
|
|
|
OPTIONS:
|
|
{{range .VisibleFlags}}{{.}}
|
|
{{end}}{{end}}
|
|
`
|
|
|
|
var MarkdownDocTemplate = `% {{ .App.Name }} 8
|
|
|
|
# NAME
|
|
|
|
{{ .App.Name }}{{ if .App.Usage }} - {{ .App.Usage }}{{ end }}
|
|
|
|
# SYNOPSIS
|
|
|
|
{{ .App.Name }}
|
|
{{ if .SynopsisArgs }}
|
|
` + "```" + `
|
|
{{ range $v := .SynopsisArgs }}{{ $v }}{{ end }}` + "```" + `
|
|
{{ end }}{{ if .App.UsageText }}
|
|
# DESCRIPTION
|
|
|
|
{{ .App.UsageText }}
|
|
{{ end }}
|
|
**Usage**:
|
|
|
|
` + "```" + `
|
|
{{ .App.Name }} [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...]
|
|
` + "```" + `
|
|
{{ if .GlobalArgs }}
|
|
# GLOBAL OPTIONS
|
|
{{ range $v := .GlobalArgs }}
|
|
{{ $v }}{{ end }}
|
|
{{ end }}{{ if .Commands }}
|
|
# COMMANDS
|
|
{{ range $v := .Commands }}
|
|
{{ $v }}{{ end }}{{ end }}`
|
|
|
|
var FishCompletionTemplate = `# {{ .App.Name }} fish shell completion
|
|
|
|
function __fish_{{ .App.Name }}_no_subcommand --description 'Test if there has been any subcommand yet'
|
|
for i in (commandline -opc)
|
|
if contains -- $i{{ range $v := .AllCommands }} {{ $v }}{{ end }}
|
|
return 1
|
|
end
|
|
end
|
|
return 0
|
|
end
|
|
|
|
{{ range $v := .Completions }}{{ $v }}
|
|
{{ end }}`
|