File: generated.gotmpl

package info (click to toggle)
golang-github-urfave-cli-v2 2.25.7-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,188 kB
  • sloc: makefile: 41; sh: 28
file content (70 lines) | stat: -rw-r--r-- 1,800 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// WARNING: this file is generated. DO NOT EDIT

package {{.PackageName}}

{{range .SortedFlagTypes}}
// {{.TypeName}} is a flag with type {{if .ValuePointer}}*{{end}}{{.GoType}}
type {{.TypeName}} struct {
  Name string

  Category string
  DefaultText string
  FilePath string
  Usage string

  Required bool
  Hidden bool
  HasBeenSet bool

  Value {{if .ValuePointer}}*{{end}}{{.GoType}}
  Destination {{if .NoDestinationPointer}}{{else}}*{{end}}{{.GoType}}

  Aliases []string
  EnvVars []string

  defaultValue {{if .ValuePointer}}*{{end}}{{.GoType}}
  
  {{range .StructFields}}
  {{.Name}} {{if .Pointer}}*{{end}}{{.Type}}
  {{end}}
}

{{if .GenerateFmtStringerInterface}}
// String returns a readable representation of this value (for usage defaults)
func (f *{{.TypeName}}) String() string {
  return {{$.UrfaveCLINamespace}}FlagStringer(f)
}
{{end}}{{/* /if .GenerateFmtStringerInterface */}}

{{if .GenerateFlagInterface}}
// IsSet returns whether or not the flag has been set through env or file
func (f *{{.TypeName}}) IsSet() bool {
  return f.HasBeenSet
}

// Names returns the names of the flag
func (f *{{.TypeName}}) Names() []string {
  return {{$.UrfaveCLINamespace}}FlagNames(f.Name, f.Aliases)
}

{{end}}{{/* /if .GenerateFlagInterface */}}

{{if .GenerateRequiredFlagInterface}}
// IsRequired returns whether or not the flag is required
func (f *{{.TypeName}}) IsRequired() bool {
  return f.Required
}
{{end}}{{/* /if .GenerateRequiredFlagInterface */}}

{{if .GenerateVisibleFlagInterface}}
// IsVisible returns true if the flag is not hidden, otherwise false
func (f *{{.TypeName}}) IsVisible() bool {
	return !f.Hidden
}
{{end}}{{/* /if .GenerateVisibleFlagInterface */}}
{{end}}{{/* /range .SortedFlagTypes */}}

// vim{{/* 👻 */}}:ro
{{/*
vim:filetype=gotexttmpl
*/}}