options

package module
v0.0.0-...-c6af8b7 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: MIT Imports: 7 Imported by: 1

README

options

-- import "github.com/cmcoffee/go-snuglib/options"

Usage

type Options
type Options struct {
}
func NewOptions
func NewOptions(header, footer string, exit_char rune) *Options

Creates new Options Menu

func (*Options) Bool
func (O *Options) Bool(desc string, value bool) *bool

Bool defines an int menu option displaying with specified desc in menu, default value, and help string. The return value is the address of an bool variable that stores the value of the option.

func (*Options) BoolVar
func (O *Options) BoolVar(p *bool, desc string, value bool)

BoolVar defines a bool menu option displaying with specified desc in menu, default value, and help string. The argument p points to a bool variable in which to store the value of the option.

func (*Options) Func
func (O *Options) Func(desc string, value func() bool)

Func defined a function within the option menu, the function should return a bool variable telling the Options menu if a change has occured.

func (*Options) Int
func (O *Options) Int(desc string, value int, help string, min, max int) *int

Int defines an int menu option displaying with specified desc in menu, default value, and help string. The return value is the address of an int variable that stores the value of the option.

func (*Options) IntVar
func (O *Options) IntVar(p *int, desc string, value int, help string, min, max int)
func (*Options) Options
func (O *Options) Options(desc string, value *Options, seperate_last bool)

Option defines an nested Options menu option displaying with specified desc in menu, seperate_last will seperate the last menu option within the sub Options when selected.

func (*Options) Register
func (T *Options) Register(input Value)

Registers an Value with Options Menu

func (*Options) Select
func (T *Options) Select(seperate_last bool) (changed bool)

Show Options Menu, if seperate_last = true, the last menu item will be dropped one line, and it's select number will be 0, seperating it from the rest.

func (*Options) String
func (O *Options) String(desc string, value string, help string, mask_value bool) *string

String defines an string menu option displaying with specified desc in menu, default value, and help string. The return value is the address of an string variable that stores the value of the option.

func (*Options) StringVar
func (O *Options) StringVar(p *string, desc string, value string, help string, mask_value bool)

StringVar defines a string flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.

type Value
type Value interface {
	Set() bool
	Get() interface{}
	String() string
}

Options Value

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

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

func NewOptions

func NewOptions(header, footer string, exit_char rune) *Options

Creates new Options Menu

func (*Options) Bool

func (O *Options) Bool(desc string, value bool) *bool

Bool defines an int menu option displaying with specified desc in menu, default value, and help string. The return value is the address of an bool variable that stores the value of the option.

func (*Options) BoolVar

func (O *Options) BoolVar(p *bool, desc string, value bool)

BoolVar defines a bool menu option displaying with specified desc in menu, default value, and help string. The argument p points to a bool variable in which to store the value of the option.

func (*Options) Func

func (O *Options) Func(desc string, value func() bool)

Func defined a function within the option menu, the function should return a bool variable telling the Options menu if a change has occured.

func (*Options) Int

func (O *Options) Int(desc string, value int, help string, min, max int) *int

Int defines an int menu option displaying with specified desc in menu, default value, and help string. The return value is the address of an int variable that stores the value of the option.

func (*Options) IntVar

func (O *Options) IntVar(p *int, desc string, value int, help string, min, max int)

func (*Options) Options

func (O *Options) Options(desc string, value *Options, seperate_last bool)

Option defines an nested Options menu option displaying with specified desc in menu, seperate_last will seperate the last menu option within the sub Options when selected.

func (*Options) Register

func (T *Options) Register(input Value)

Registers an Value with Options Menu

func (*Options) Select

func (T *Options) Select(seperate_last bool) (changed bool)

Show Options Menu, if seperate_last = true, the last menu item will be dropped one line, and it's select number will be 0, seperating it from the rest.

func (*Options) String

func (O *Options) String(desc string, value string, help string, mask_value bool) *string

String defines an string menu option displaying with specified desc in menu, default value, and help string. The return value is the address of an string variable that stores the value of the option.

func (*Options) StringVar

func (O *Options) StringVar(p *string, desc string, value string, help string, mask_value bool)

StringVar defines a string flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.

type Value

type Value interface {
	Set() bool
	Get() interface{}
	String() string
}

Options Value

Jump to

Keyboard shortcuts

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