You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
urfave-cli/flag-generator/templates/altsrc_flags_generated.gotpl

36 lines
1.0 KiB

// Code generated by fg; DO NOT EDIT.
package {{ .PackageName }}
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
type {{ $flag.Name }}Flag struct {
cli.{{ $flag.Name }}Flag
set *flag.FlagSet
}
// New{{ $flag.Name }}Flag creates a new {{ $flag.Name }}Flag
func New{{ $flag.Name }}Flag(fl cli.{{ $flag.Name }}Flag) *{{ $flag.Name }}Flag {
return &{{ $flag.Name }}Flag{ {{ $flag.Name }}Flag: fl, set: nil }
}
// Apply saves the flagSet for later usage calls, then calls
// the wrapped {{ $flag.Name }}Flag.Apply
func (f *{{ $flag.Name }}Flag) Apply(set *flag.FlagSet) {
f.set = set
f.{{ $flag.Name }}Flag.Apply(set)
}
// ApplyWithError saves the flagSet for later usage calls, then calls
// the wrapped {{ $flag.Name }}Flag.ApplyWithError
func (f *{{ $flag.Name }}Flag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.{{ $flag.Name }}Flag.ApplyWithError(set)
}
{{- end }}