Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalDotEnv ¶
func RegisterFlags ¶
func RegisterFlags[T any](config *T, persistent bool, app *cobra.Command, options ...ParseOption) func() error
Parse takes every object and is able to fill and validate that object depending on config file, env file and flag values. https://github.com/knadh/koanf Your passed struct must define . delimited koanf struct tags in order to match env/.env and flag values to your struct. Additionally your struct may define a Validate() error method which is called at the end of parsing the config Registers flags and returns a parser function that can be used as PreRunE.
Types ¶
type Config ¶
type Config struct { OpenAPIFilePath string `koanf:"file" short:"f" description:"file path to your openapi.yaml"` OutFilePath string `koanf:"out" short:"o" description:"out file path or 'stdout'"` PackageName string `koanf:"package" short:"p" description:"package name of the generated file"` // contains filtered or unexported fields }
func NewDefaultConfig ¶
func NewDefaultConfig() Config
type ParseOption ¶
type ParseOption func(*parseOption)
func WithDelimiter ¶
func WithDelimiter(delimiter string) ParseOption
func WithDescriptionStructTagName ¶
func WithDescriptionStructTagName(tag string) ParseOption
func WithEnvPrefix ¶
func WithEnvPrefix(prefix string) ParseOption
func WithStructTagName ¶
func WithStructTagName(tag string) ParseOption
type Validatable ¶
type Validatable interface {
Validate() error
}
Click to show internal directories.
Click to hide internal directories.