parsed

package
v0.0.0-...-8b68c8a Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: GPL-3.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFlagArgValuesNilPointer - call by nil pointer
	ErrFlagArgValuesNilPointer = errors.New(`Result.FlagArgValues error: Result pointer is nil`)

	// ErrFlagArgValuesNoArgValues - placeholder doesn't contain parsed arguments
	ErrFlagArgValuesNoArgValues = errors.New(`Result.FlagArgValues error: placeholder doesn't contain parsed arguments`)

	// ErrFlagArgValuesNoPlaceholder - placeholder is not found by nameFlag
	ErrFlagArgValuesNoPlaceholder = errors.New(`Result.FlagArgValues error: placeholder is not found`)
)
View Source
var (
	// ErrPlaceholderArgValuesNilPointer - call by nil pointer
	ErrPlaceholderArgValuesNilPointer = errors.New(`Result.PlaceholderArgValues error: Result pointer is nil`)

	// ErrPlaceholderArgValuesNoArgValues - placeholder doesn't contain parsed arguments
	ErrPlaceholderArgValuesNoArgValues = errors.New(`Result.PlaceholderArgValues error: placeholder doesn't contain parsed arguments`)

	// ErrPlaceholderArgValuesNoPlaceholder - placeholder is not found by nameFlag
	ErrPlaceholderArgValuesNoPlaceholder = errors.New(`Result.PlaceholderArgValues error: placeholder is not found`)
)

Functions

This section is empty.

Types

type ArgValue

type ArgValue string

ArgValue - string value of an argument

const ArgValueDefault ArgValue = ""

ArgValueDefault - default value of ArgValue type

func MakeArgValue

func MakeArgValue(arg clArg.Argument) ArgValue

MakeArgValue constructs ArgValue from Argument

func RandArgValue

func RandArgValue() ArgValue

RandArgValue returns random ArgValue

func RandArgValueSecond

func RandArgValueSecond() ArgValue

RandArgValueSecond returns random ArgValue

func RandArgValueThird

func RandArgValueThird() ArgValue

RandArgValueThird returns random ArgValue

func (ArgValue) Float32

func (i ArgValue) Float32() (float32, error)

Float32 converts ArgValue object to float32

func (ArgValue) Float64

func (i ArgValue) Float64() (float64, error)

Float64 converts ArgValue object to float64

func (ArgValue) Int16

func (i ArgValue) Int16() (int16, error)

Int16 converts ArgValue object to int16

func (ArgValue) Int32

func (i ArgValue) Int32() (int32, error)

Int32 converts ArgValue object to int32

func (ArgValue) Int64

func (i ArgValue) Int64() (int64, error)

Int64 converts ArgValue object to int64

func (ArgValue) Int8

func (i ArgValue) Int8() (int8, error)

Int8 converts ArgValue object to int16

func (ArgValue) String

func (i ArgValue) String() string

String implements Stringer interface

func (ArgValue) Uint16

func (i ArgValue) Uint16() (uint16, error)

Uint16 converts ArgValue object to uint16

func (ArgValue) Uint32

func (i ArgValue) Uint32() (uint32, error)

Uint32 converts ArgValue object to uint32

func (ArgValue) Uint64

func (i ArgValue) Uint64() (uint64, error)

Uint64 converts ArgValue object to uint64

func (ArgValue) Uint8

func (i ArgValue) Uint8() (uint8, error)

Uint8 converts ArgValue object to uint8

type Argument

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

Argument contains parsed argument values of a nameMainCommand or a flagName

func MakeArgument

func MakeArgument(opt *ArgumentOpt) *Argument

MakeArgument converts opt to Result pointer

func (*Argument) GetArgValues

func (i *Argument) GetArgValues() []ArgValue

GetArgValues gets ArgValues field

type ArgumentOpt

type ArgumentOpt struct {
	ArgValues []ArgValue
}

ArgumentOpt contains source data for cast to Argument

type Placeholder

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

Placeholder contains parsed flagName and arguments array

func NewPlaceholder

func NewPlaceholder(opt *PlaceholderOpt) *Placeholder

NewPlaceholder converts opt to Placeholder pointer

func (*Placeholder) GetArgData

func (p *Placeholder) GetArgData() *Argument

GetArgData gets Argument field

func (*Placeholder) GetID

func (p *Placeholder) GetID() coty.IDPlaceholder

GetID gets id field

func (*Placeholder) GetNameFlag

func (p *Placeholder) GetNameFlag() coty.NameFlag

GetNameFlag gets flagName field

func (*Placeholder) HasArg

func (p *Placeholder) HasArg() bool

HasArg returns if Placeholder has Argument option

func (*Placeholder) HasFlag

func (p *Placeholder) HasFlag() bool

HasFlag returns if Placeholder has Flag option

type PlaceholderOpt

type PlaceholderOpt struct {
	ID       coty.IDPlaceholder
	Flag     coty.NameFlag
	Argument *ArgumentOpt
}

PlaceholderOpt contains source data for cast to Placeholder

type Result

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

Result contains a result of nameMainCommand line arguments parsing

func MakeResult

func MakeResult(opt *ResultOpt) *Result

MakeResult converts opt to Result pointer

func (*Result) FlagArgValue

func (i *Result) FlagArgValue(name coty.NameFlag) (value ArgValue, err error)

FlagArgValue extracts flagName argument value

func (*Result) FlagArgValues

func (i *Result) FlagArgValues(name coty.NameFlag) (values []ArgValue, err error)

FlagArgValues - extract flagName argument value slice

func (*Result) GetCommandMainName

func (i *Result) GetCommandMainName() coty.NameCommand

GetCommandMainName gets nameMainCommand field

func (*Result) GetPlaceholdersByIDs

func (i *Result) GetPlaceholdersByIDs() map[coty.IDPlaceholder]*Placeholder

GetPlaceholdersByIDs gets placeholdersByIDs field

func (*Result) PlaceholderArgValue

func (i *Result) PlaceholderArgValue(id coty.IDPlaceholder) (value ArgValue, err error)

func (*Result) PlaceholderArgValues

func (i *Result) PlaceholderArgValues(id coty.IDPlaceholder) (values []ArgValue, err error)

func (*Result) PlaceholderByID

func (i *Result) PlaceholderByID(id coty.IDPlaceholder) *Placeholder

PlaceholderByID returns Placeholder by IDPlaceholder

type ResultOpt

type ResultOpt struct {
	CommandMainName  coty.NameCommand
	PlaceholdersByID map[coty.IDPlaceholder]*PlaceholderOpt
}

ResultOpt contains source data for cast to Result

func (*ResultOpt) PlaceholderByID

func (opt *ResultOpt) PlaceholderByID(argGroupID coty.IDPlaceholder) *PlaceholderOpt

PlaceholderByID returns Placeholder by IDPlaceholder

func (*ResultOpt) PlaceholderDoesNotHaveArgs

func (opt *ResultOpt) PlaceholderDoesNotHaveArgs(argGroupID coty.IDPlaceholder) bool

PlaceholderDoesNotHaveArgs returns if the group with argGroupID doesn't have arguments

func (*ResultOpt) SetArg

func (opt *ResultOpt) SetArg(argGroupID coty.IDPlaceholder, arg ArgValue)

SetArg sets ArgValue into Placeholder by IDPlaceholder

func (*ResultOpt) SetFlagName

func (opt *ResultOpt) SetFlagName(placeholderID coty.IDPlaceholder, flag coty.NameFlag)

SetFlagName sets NameFlag into Placeholder by IDPlaceholder

Jump to

Keyboard shortcuts

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