binary

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook added in v0.0.14

type Hook func(b bool) error

type Opt

type Opt struct {
	meta.Data

	Def bool
	// contains filtered or unexported fields
}

Opt stores an boolean configuration value

func New

func New(m meta.Data, def bool, hook ...Hook) *Opt

New creates a new Opt with default values set

func (*Opt) AddHooks

func (x *Opt) AddHooks(hook ...Hook)

AddHooks appends callback hooks to be run when the value is changed

func (*Opt) F

func (x *Opt) F() *Opt

F sets the value to false

func (*Opt) False

func (x *Opt) False() bool

False returns whether the value is false (it returns the inverse of the value)

func (*Opt) Flip

func (x *Opt) Flip()

Flip changes the value to its opposite

func (*Opt) GetMetadata

func (x *Opt) GetMetadata() *meta.Data

GetMetadata returns the metadata of the opt type

func (*Opt) LoadInput

func (x *Opt) LoadInput(input string) (o opt.Option, e error)

LoadInput sets the value from a string (this is the same as the above but differs for Strings)

func (*Opt) MarshalJSON

func (x *Opt) MarshalJSON() (b []byte, e error)

MarshalJSON returns the json representation of a Opt

func (*Opt) Name

func (x *Opt) Name() string

Name returns the name of the opt

func (*Opt) ReadInput

func (x *Opt) ReadInput(input string) (o opt.Option, e error)

ReadInput sets the value from a string. The value can be right up against the keyword or separated by a '='.

func (*Opt) Set

func (x *Opt) Set(b bool) (e error)

Set changes the value currently stored

func (*Opt) SetHooks

func (x *Opt) SetHooks(hook ...Hook)

SetHooks sets a new slice of hooks

func (*Opt) SetName

func (x *Opt) SetName(name string)

SetName sets the name for the generator

func (*Opt) String

func (x *Opt) String() string

String returns a string form of the value

func (*Opt) T

func (x *Opt) T() *Opt

T sets the value to true

func (*Opt) True

func (x *Opt) True() bool

True returns whether the value is set to true (it returns the value)

func (*Opt) Type

func (x *Opt) Type() interface{}

Type returns the receiver wrapped in an interface for identifying its type

func (*Opt) UnmarshalJSON

func (x *Opt) UnmarshalJSON(data []byte) (e error)

UnmarshalJSON decodes a JSON representation of a Opt

Jump to

Keyboard shortcuts

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