mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
zsh-completion: remove temporary file
Yet another temporary file that found itself in the repo :(
This commit is contained in:
parent
50f385938e
commit
0d9a33d2da
1 changed files with 0 additions and 56 deletions
|
@ -1,56 +0,0 @@
|
||||||
{{define "complexFlag"}}{{ /* for pflag.Flag with short and long options */ -}}
|
|
||||||
"(-{{.Shorthand}} --{{.Name}})"\{-{{.Shorthand}}, --{{.Name}}\}[{{.Usage}}]
|
|
||||||
{{- end}}
|
|
||||||
|
|
||||||
{{define "simpleFlag"}}{{ /* for pflag.Flag with either short or long options */ -}}
|
|
||||||
"{{with .Name}}-{{.}}{{else}}--{{.Shorthand}}{{end}}[{{.Usage}}]"
|
|
||||||
{{- end}}
|
|
||||||
|
|
||||||
{{define "argumentsC"}}
|
|
||||||
{{- /* should accept Command (that contains subcommands) as parameter */ -}}
|
|
||||||
function {{constructPath .}} {
|
|
||||||
local line
|
|
||||||
|
|
||||||
_arguments -C \
|
|
||||||
{{range extractFlags . -}}
|
|
||||||
{{if simpleFlag .}}{{template "simpleFlag" .}}{{else}}{{template "complexFlag" .}}{{end}} \
|
|
||||||
{{end -}}
|
|
||||||
"1: :({{subCmdList .}})" \
|
|
||||||
"*:arg:->args"
|
|
||||||
|
|
||||||
case $line[1] in
|
|
||||||
{{range .Commands -}}
|
|
||||||
{{.Use}})
|
|
||||||
{{constructPath .}}
|
|
||||||
;;
|
|
||||||
{{end -}}
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
{{range .Commands -}}
|
|
||||||
|
|
||||||
{{template "selectCmdTemplate" .}}
|
|
||||||
{{end -}}
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{define "arguments"}}
|
|
||||||
function {{constructPath .}} {
|
|
||||||
{{- /* should accept Command without subcommands as parameter */ -}}
|
|
||||||
{{with extractFlags . -}}
|
|
||||||
_arguments \
|
|
||||||
{{range .}}
|
|
||||||
{{if simpleFlag .}}{{template "simpleFlag" .}}{{else}}{{template "complexFlag" .}}{{end}} \
|
|
||||||
{{end -}}
|
|
||||||
{{ /* leave this line empty because of the last backslash */ }}
|
|
||||||
{{end -}}
|
|
||||||
}
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{define "selectCmdTemplate" -}}
|
|
||||||
{{with .Commands}}{{template "argumentsC" .}}{{else}}{{template "arguments" .}}{{end}}
|
|
||||||
{{end -}}
|
|
||||||
|
|
||||||
{{define "Main"}}
|
|
||||||
#compdef _{{.Use}} {{.Use}}
|
|
||||||
|
|
||||||
{{template "selectCmdTemplate" .}}
|
|
||||||
{{end}}
|
|
Loading…
Reference in a new issue