cligobrr

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 5 Imported by: 0

README

cligobrr

Golang implementation of clive. clive was my first real Vlang project, and cligobrr is my first real Golang project. I know test coverage needs to be improved, and I need to write docs. That will all come in time. I needed to get this to a working state so I could start translating a project at work from Vlang to Golang.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	AppFields
	Cmds Cmds
	Args Args
}

func AppNew

func AppNew(fields AppFields) *App

func (*App) Parse

func (self *App) Parse(input []string) (*Cmd, error)

type AppFields

type AppFields struct {
	Name        string
	Description string
	Version     string
}

type Arg

type Arg struct {
	ArgFields
	// contains filtered or unexported fields
}

func (*Arg) AsBool

func (self *Arg) AsBool() (bool, error)

func (*Arg) AsBools

func (self *Arg) AsBools() ([]bool, error)

func (*Arg) AsFloat

func (self *Arg) AsFloat() (float64, error)

func (*Arg) AsFloats

func (self *Arg) AsFloats() ([]float64, error)

func (*Arg) AsInt

func (self *Arg) AsInt() (int64, error)

func (*Arg) AsInts

func (self *Arg) AsInts() ([]int64, error)

func (*Arg) AsString

func (self *Arg) AsString() (string, error)

func (*Arg) AsStrings

func (self *Arg) AsStrings() ([]string, error)

func (*Arg) GetAlias

func (self *Arg) GetAlias() string

func (*Arg) GetChoices

func (self *Arg) GetChoices() []string

func (*Arg) GetDefault

func (self *Arg) GetDefault() string

func (*Arg) GetDescription

func (self *Arg) GetDescription() string

func (*Arg) GetKind

func (self *Arg) GetKind() string

func (*Arg) GetMultiple

func (self *Arg) GetMultiple() bool

func (*Arg) GetName

func (self *Arg) GetName() string

func (*Arg) GetRequired

func (self *Arg) GetRequired() bool

func (*Arg) GetSeparator

func (self *Arg) GetSeparator() string

func (*Arg) Parse

func (self *Arg) Parse(input string)

func (*Arg) Store

func (self *Arg) Store(values []string)

func (*Arg) Stored

func (self *Arg) Stored() []string

func (*Arg) Validate

func (self *Arg) Validate() error

type ArgFields

type ArgFields struct {
	Name        string
	Alias       string
	Description string
	Separator   string
	Multiple    bool
	Required    bool
	Default     string
	Choices     []string
}

type Args

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

func (*Args) Add

func (self *Args) Add(arg IArg)

func (*Args) AsBool

func (self *Args) AsBool(identifier string) (bool, error)

func (*Args) AsBools

func (self *Args) AsBools(identifier string) ([]bool, error)

func (*Args) AsFloat

func (self *Args) AsFloat(identifier string) (float64, error)

func (*Args) AsFloats

func (self *Args) AsFloats(identifier string) ([]float64, error)

func (*Args) AsInt

func (self *Args) AsInt(identifier string) (int64, error)

func (*Args) AsInts

func (self *Args) AsInts(identifier string) ([]int64, error)

func (*Args) AsString

func (self *Args) AsString(identifier string) (string, error)

func (*Args) AsStrings

func (self *Args) AsStrings(identifier string) ([]string, error)

func (*Args) Parse

func (self *Args) Parse(input []string) error

type BoolArg

type BoolArg struct {
	Arg
}

func (*BoolArg) Validate

func (self *BoolArg) Validate() error

type Cmd

type Cmd struct {
	CmdFields
	Cmds Cmds
	Args Args
}

func CmdNew

func CmdNew(fields CmdFields) (*Cmd, error)

func (*Cmd) Parse

func (self *Cmd) Parse(args []string) (*Cmd, error)

type CmdFields

type CmdFields struct {
	Name         string
	Alias        string
	Description  string
	Default      bool
	Exec         FuncCmdExec
	ExecWithArgs FuncCmdExecWithArgs
}

type Cmds

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

func (*Cmds) Add

func (self *Cmds) Add(cmd *Cmd)

type FloatArg

type FloatArg struct {
	Arg
}

func (*FloatArg) Validate

func (self *FloatArg) Validate() error

type FuncCmdExec

type FuncCmdExec func()

type FuncCmdExecWithArgs added in v0.2.0

type FuncCmdExecWithArgs func(args Args)

type IArg

type IArg interface {
	GetKind() string
	GetName() string
	GetAlias() string
	GetDescription() string
	GetSeparator() string
	GetMultiple() bool
	GetRequired() bool
	GetDefault() string
	GetChoices() []string
	AsBool() (bool, error)
	AsBools() ([]bool, error)
	AsFloat() (float64, error)
	AsFloats() ([]float64, error)
	AsInt() (int64, error)
	AsInts() ([]int64, error)
	AsString() (string, error)
	AsStrings() ([]string, error)
	Validate() error
	Parse(string)
	Store([]string)
	Stored() []string
}

func BoolArgNew

func BoolArgNew(fields ArgFields) (IArg, error)

func FloatArgNew

func FloatArgNew(fields ArgFields) (IArg, error)

func IntArgNew

func IntArgNew(fields ArgFields) (IArg, error)

func StringArgNew

func StringArgNew(fields ArgFields) (IArg, error)

type IntArg

type IntArg struct {
	Arg
}

func (*IntArg) Validate

func (self *IntArg) Validate() error

type StringArg

type StringArg struct {
	Arg
}

type Table

type Table struct {
	TableFields
	// contains filtered or unexported fields
}

func (*Table) Add

func (self *Table) Add(row []string) error

func (*Table) ToString

func (self *Table) ToString() string

type TableFields

type TableFields struct {
	Cols uint8
	Pad  uint8
}

Jump to

Keyboard shortcuts

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