pTools

package
v0.0.0-...-f800b22 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TrueHlc  = "true"
	YesHlc   = "yes"
	OnHlc    = "on"
	FalseHlc = "false"
	NoHlc    = "no"
	OffHlc   = "off"
)

common and global hlcs.

Variables

This section is empty.

Functions

func IsEqualitySign

func IsEqualitySign(r rune) bool

func IsFlag

func IsFlag(value string) bool

func ToBoolType

func ToBoolType(value string) bool

Types

type Arg

type Arg []string

Arg is the arguments for commands

func (*Arg) GetFlags

func (_a *Arg) GetFlags() []string

GetFlags will give you all of the flags of this Arg value.

func (*Arg) GetNonFlags

func (_a *Arg) GetNonFlags() []string

GetFlags will give you all of the non-flags of this Arg value. Notice: if the _a has no non-flag value, this function will give you nil (or an array with zero length).

func (*Arg) HasFlag

func (_a *Arg) HasFlag(flags ...string) bool

HasFlag will check if at least one of the flags is present in flags or not. notice: this method, will check for at least one of them, it means if it finds one of the flags value, it will return true. if you want to search for all of them, consider using HasFlags.

func (*Arg) HasFlags

func (_a *Arg) HasFlags(flags ...string) bool

HasFlags will check if all of the flags are present in flags or not. notice: this method, will check for all of them, it means if it doesn't find one of the flags value, it will return false. if you want to search for at least one of them, consider using HasFlag.

func (*Arg) JoinNoneFlags

func (_a *Arg) JoinNoneFlags(command bool) string

JoinNoneFlags will join all the none-flags elements in the arg. set command to true if you want to include the command itself.

type EventArgs

type EventArgs struct {
	ParseError *string
}

func ParseArg

func ParseArg(text string, hlc HlcCollection) *EventArgs

type Flag

type Flag struct {
	Name  string
	Index int

	Type FlagType
	// contains filtered or unexported fields
}

Flag is the options passed along with the commands by users. they should send them with prefex "--", but we will remove them in the pTools.

func (*Flag) GetValue

func (f *Flag) GetValue() interface{}

type FlagType

type FlagType uint8
const (
	NoneFlagType   FlagType = 0
	BoolFlagType   FlagType = 1
	StringFlagType FlagType = 2
	UInt8FlagType  FlagType = 3
	UInt16FlagType FlagType = 4
	UInt32FlagType FlagType = 5
	UInt64FlagType FlagType = 6
	Int8FlagType   FlagType = 7
	Int16FlagType  FlagType = 8
	Int32FlagType  FlagType = 9
	Int64FlagType  FlagType = 10
)

func (*FlagType) Compare

func (t *FlagType) Compare(value *FlagType) bool

func (*FlagType) IsInteger

func (t *FlagType) IsInteger() bool

func (*FlagType) ToString

func (t *FlagType) ToString() string

type Hlc

type Hlc struct {
	Name  string
	Value interface{}
	Type  FlagType
}

High-level constant.

type HlcCollection

type HlcCollection []Hlc

func GetHlcCollection

func GetHlcCollection(h ...Hlc) HlcCollection

func (*HlcCollection) Contains

func (c *HlcCollection) Contains(name string) bool

func (*HlcCollection) GetValue

func (c *HlcCollection) GetValue(name string) (interface{}, FlagType)

Directories

Path Synopsis
Package argparse provides users with more flexible and configurable option for command line arguments parsing.
Package argparse provides users with more flexible and configurable option for command line arguments parsing.

Jump to

Keyboard shortcuts

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