Skip to content

Commit

Permalink
indentation fixes in template
Browse files Browse the repository at this point in the history
regeneration test
  • Loading branch information
asahasrabuddhe committed Aug 4, 2019
1 parent c4fc88e commit c676ed4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
1 change: 0 additions & 1 deletion altsrc/flag_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions flag-gen/assets_vfsdata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions flag-gen/templates/altsrc_flags_generated.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"flag"
"github.com/urfave/cli"
)

{{ range $i, $flag := .Flags }}
// {{ $flag.Name }}Flag is the flag type that wraps cli.{{ $flag.Name }}Flag to allow
// for other values to be specified
Expand All @@ -33,4 +32,4 @@ func (f *{{ $flag.Name }}Flag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.{{ $flag.Name }}Flag.ApplyWithError(set)
}
{{- end }}
{{ end }}
8 changes: 4 additions & 4 deletions flag-gen/templates/cli_flags_generated.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ func (f {{ $flag.Name }}Flag) IsRequired() bool {

// {{ $flag.Name }} looks up the value of a local {{ $flag.Name }}Flag, returns
// {{ $flag.ContextDefault }} if not found
func (c *Context) {{ $flag.Name }}(name string) {{ if ne .ContextType "" }} {{ $flag.ContextType }} {{ else }} {{ $flag.Type }} {{- end }} {
func (c *Context) {{ $flag.Name }}(name string){{ if ne .ContextType "" }} {{ $flag.ContextType }} {{ else }} {{ $flag.Type }} {{- end }} {
return lookup{{ $flag.Name }}(name, c.flagSet)
}

// Global{{ $flag.Name }} looks up the value of a global {{ $flag.Name }}Flag, returns
// {{ $flag.ContextDefault }} if not found
func (c *Context) Global{{ $flag.Name }}(name string) {{ if ne .ContextType "" }} {{ $flag.ContextType }} {{ else }} {{ $flag.Type }} {{- end }} {
func (c *Context) Global{{ $flag.Name }}(name string){{ if ne .ContextType "" }} {{ $flag.ContextType }} {{ else }} {{ $flag.Type }} {{- end }} {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookup{{ $flag.Name }}(name, fs)
}
return {{ $flag.ContextDefault }}
}

func lookup{{ $flag.Name }}(name string, set *flag.FlagSet) {{ if ne .ContextType "" }} {{ $flag.ContextType }} {{ else }} {{ $flag.Type }} {{- end }} {
func lookup{{ $flag.Name }}(name string, set *flag.FlagSet){{ if ne .ContextType "" }} {{ $flag.ContextType }} {{ else }} {{ $flag.Type }} {{- end }} {
f := set.Lookup(name)
if f != nil {
{{ if ne .Parser "" }}parsed, err := {{ $flag.Parser }}{{ else }}parsed, err := f.Value, error(nil){{ end }}
Expand All @@ -66,4 +66,4 @@ func lookup{{ $flag.Name }}(name string, set *flag.FlagSet) {{ if ne .ContextTyp
}
return {{ $flag.ContextDefault }}
}
{{- end }}
{{ end }}

0 comments on commit c676ed4

Please sign in to comment.