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"
2019-08-04 14:53:32 +00:00
"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 {
2019-08-04 14:53:32 +00:00
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 {
2019-08-04 14:53:32 +00:00
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 {
2019-08-04 14:53:32 +00:00
f.set = set
return f.{{ $flag.Name }}Flag.ApplyWithError(set)
}
{{ end }}