Skip to content

Commit

Permalink
Fix generator whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
abitrolly committed Jul 22, 2023
1 parent 4d1267c commit 648b8c6
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions cmd/urfave-cli-genflags/generated.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package {{.PackageName}}

{{range .SortedFlagTypes}}
{{range .SortedFlagTypes -}}
// {{.TypeName}} is a flag with type {{if .ValuePointer}}*{{end}}{{.GoType}}
type {{.TypeName}} struct {
Name string
Expand All @@ -23,20 +23,20 @@ type {{.TypeName}} struct {
EnvVars []string

defaultValue {{if .ValuePointer}}*{{end}}{{.GoType}}

{{range .StructFields}}
{{ range .StructFields}}
{{.Name}} {{if .Pointer}}*{{end}}{{.Type}}
{{end}}
{{end -}}
}

{{if .GenerateFmtStringerInterface}}
{{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}}
{{- if .GenerateFlagInterface -}}
// IsSet returns whether or not the flag has been set through env or file
func (f *{{.TypeName}}) IsSet() bool {
return f.HasBeenSet
Expand All @@ -49,22 +49,23 @@ func (f *{{.TypeName}}) Names() []string {

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

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

{{end}}{{/* /if .GenerateRequiredFlagInterface */}}

{{if .GenerateVisibleFlagInterface}}
{{- 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"}}:ro
{{- /* 👻
vim:filetype=gotexttmpl
*/}}

0 comments on commit 648b8c6

Please sign in to comment.