utilities

package
v0.0.0-...-465f6ca Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REQUIRED int = iota
	NOARG
	OPTIONAL
)

option argument type

Variables

View Source
var (
	ErrNilArgv       = errors.New("argv is nil")
	ErrUnExpectedArg = errors.New("unexpected argument '-'")
)

error

Functions

func CopyFile

func CopyFile(src, dest string) error

CopyFile todo

func ErrorCat

func ErrorCat(sv ...string) error

ErrorCat todo

func PathDirExists

func PathDirExists(p string) bool

PathDirExists todo

func PathExists

func PathExists(p string) bool

PathExists path exists

func StrCat

func StrCat(sv ...string) string

StrCat cat strings: You should know that StrCat gradually builds advantages only when the number of parameters is> 2.

func StrSplitSkipEmpty

func StrSplitSkipEmpty(s string, sep byte, suggestcap int) []string

StrSplitSkipEmpty skip empty string suggestcap is suggest cap

Types

type ArgvParser

type ArgvParser struct {
	SubcmdMode bool // subcmd mode
	// contains filtered or unexported fields
}

ArgvParser todo

func (*ArgvParser) Add

func (ae *ArgvParser) Add(name string, ha, val int)

Add option

func (*ArgvParser) Execute

func (ae *ArgvParser) Execute(argv []string, ac Receiver) error

Execute todo

func (*ArgvParser) Unresolved

func (ae *ArgvParser) Unresolved() []string

Unresolved todo

type Derivator

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

Derivator expand env engine

func NewDerivator

func NewDerivator() *Derivator

NewDerivator create env derivative

func (*Derivator) AddBashCompatible

func (de *Derivator) AddBashCompatible()

AddBashCompatible $0~$9

func (*Derivator) Append

func (de *Derivator) Append(k, v string) error

Append append to env

func (*Derivator) Environ

func (de *Derivator) Environ() []string

Environ create new environ block

func (*Derivator) EraseEnv

func (de *Derivator) EraseEnv(k string)

EraseEnv k

func (*Derivator) ExpandEnv

func (de *Derivator) ExpandEnv(s string) string

ExpandEnv env

func (*Derivator) GetEnv

func (de *Derivator) GetEnv(k string) string

GetEnv env

type Receiver

type Receiver interface {
	Invoke(val int, oa, raw string) error
}

Receiver todo

Jump to

Keyboard shortcuts

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