urfave-cli/flag-gen/templates/altsrc_flags_generated.gotpl

35 lines
1.0 KiB
Plaintext
Raw Normal View History

// 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 }}