test

package
Version: v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MyDuration added in v0.5.0

type MyDuration time.Duration

func (MyDuration) MarshalText added in v0.5.0

func (d MyDuration) MarshalText() (text []byte, err error)

MarshalText writes duration value in text format.

func (MyDuration) String added in v0.5.0

func (d MyDuration) String() string

String returns the string representation of the duration.

func (*MyDuration) UnmarshalText added in v0.5.0

func (d *MyDuration) UnmarshalText(text []byte) error

type MyMain

type MyMain struct {
	Thing string `flag:"thing" help:"does a thing"`

	Bing string `flag:"-" help:"shouldn't happen"`

	AIPMask  net.IPMask `flag:"ipmask"`
	AIPNet   net.IPNet
	AIP      net.IP
	AIPSlice []net.IP

	Abool     bool `flag:"a-bool" help:"boolean flag" short:"b"`
	Aint      int  `flag:"a-int" help:"int flag"`
	Aint8     int8
	Aint16    int16 `json:"anint16"`
	Aint32    int32
	Aint64    int64   `flag:"a-int64" help:"int64 flag"`
	Afloat    float64 `flag:"a-float" help:"float flag" short:"f"`
	Afloat32  float32
	Auint     uint `flag:"a-uint" help:"uint flag"`
	Auint8    uint8
	Auint16   uint16
	Auint32   uint32
	Auint64   uint64        `flag:"a-uint64" help:"uint64 flag"`
	Aduration time.Duration `flag:"a-duration" help:"duration flag"`

	AStringSlice []string `help:"string slice flag"`
	ABoolSlice   []bool
	AIntSlice    []int
	AUintSlice   []uint

	SubThing SubThing `flag:"subthing"`
	// contains filtered or unexported fields
}

MyMain defines a variety of different field types and exercises various different tags.

func NewMyMain added in v0.2.0

func NewMyMain() *MyMain

func (*MyMain) Run

func (m *MyMain) Run() error

Run implements the Runner interface.

type Recursion added in v0.5.0

type Recursion struct {
	NestBool bool `flag:"b-bool" help:"doubly nested boolean flag"`
}

Recursion exists to test multiple levels of nested structs.

type SimpleMain added in v0.2.0

type SimpleMain struct {
	One    string
	Two    int
	Three  int64
	Four   bool
	Five   uint
	Six    uint64
	Seven  float64
	Eight  time.Duration
	Nine   []string
	Ten    time.Time
	Eleven MyDuration
}

func NewSimpleMain added in v0.2.0

func NewSimpleMain() *SimpleMain

func (*SimpleMain) Run added in v0.2.0

func (m *SimpleMain) Run() error

type SubThing

type SubThing struct {
	SubBool   bool      `flag:"a-bool" help:"nested boolean flag"`
	Recursion Recursion `flag:"recursion"`
}

SubThing exists to test nested structs.

Source Files

Jump to

Keyboard shortcuts

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