arg

package
v1.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2021 License: JSON Imports: 6 Imported by: 0

Documentation

Overview

This is an interceptor dedicated to push flags found to the final schema given by gautocloud. if flags is not a zero value it will override value from schema given by gautocloud. It use https://github.com/alexflint/go-arg to translate flags into a struct.

Example
Output:

arg_test.MyConfig{Foo:"bar", Bar:true, Orig:"<injected by gautocloud>"}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Args

func Args(args []string) optSetter

Option to set args to be parsed as flags Default: os.Args

func Config

func Config(config arg.Config) optSetter

Option to set arg.Config from https://github.com/alexflint/go-arg Default: arg.Config{}

func Exit

func Exit(exit bool) optSetter

Option to exit program or not when --help or --version flags has been found Default: true

func Writer

func Writer(w io.Writer) optSetter

Option to set writer for output Default: os.Stdout

Types

type ArgInterceptor

type ArgInterceptor struct {
	// contains filtered or unexported fields
}

func NewArg

func NewArg(setters ...optSetter) *ArgInterceptor

func (ArgInterceptor) Intercept

func (i ArgInterceptor) Intercept(current, found interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL