cli

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

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

CLI holds the closing channel and the defined commands.

func New

func New() *CLI

New creates a CLI struct.

func (*CLI) BoolValue

func (cli *CLI) BoolValue(flag, c string, flags map[string]string) (bool, error)

BoolValue returns the bool value from the flag list.

func (*CLI) Command

func (cli *CLI) Command(name string) *command

Command returns a command reference

func (*CLI) DoubleValue

func (cli *CLI) DoubleValue(flag, c string, flags map[string]string) (float64, error)

DoubleValue returns the float64 value from the flag list.

func (*CLI) Execute

func (cli *CLI) Execute(textCmd string) (bool, error)

Execute parses a string and applies the f function. Returns true for exiting.

func (*CLI) FlagValue

func (cli *CLI) FlagValue(command, flag string, flags map[string]string) (interface{}, error)

FlagValue returns the value from the flag list.

func (*CLI) HandlerFunc

func (cli *CLI) HandlerFunc(commandName string, handler func(flags map[string]string) error)

HandlerFunc adds a handler to the specific command

func (*CLI) IntValue

func (cli *CLI) IntValue(flag, c string, flags map[string]string) (int, error)

IntValue returns the int value from the flag list.

func (*CLI) New

func (cli *CLI) New(name, shortDesc, description string, handler func(flags map[string]string) error) *command

New creates a command

func (*CLI) Run

func (cli *CLI) Run()

Run begins reading from the Stdin for ever. Parses the command given and apply it to the command handler.

func (*CLI) String

func (cli *CLI) String() string

func (*CLI) StringValue

func (cli *CLI) StringValue(flag, c string, flags map[string]string) string

StringValue returns the string value from the flag list.

Jump to

Keyboard shortcuts

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