cmd

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VERSION = "unknown"
	CmdName = "mon"
)

Functions

func Debug

func Debug(v ...interface{})

func Getpid

func Getpid() int

func PrintCmdHelp

func PrintCmdHelp(pro *Program)

Types

type CMD

type CMD func(*Program)

type Context

type Context struct {
	Single        *Program
	CmdMap        map[string]*Program
	ParamGroupMap map[string]*ParamGroup
}

func NewContext

func NewContext() *Context

func (*Context) GetDefCmdMap

func (ct *Context) GetDefCmdMap()

func (*Context) ParseArgs

func (ct *Context) ParseArgs(args []string, program *Program) error

func (*Context) Run

func (ct *Context) Run()

func (*Context) ShowHelp

func (ct *Context) ShowHelp()

type ParamDef

type ParamDef struct {
	Name      string // -t 10
	LongName  string // --time=10
	NeedValue bool
	Desc      string
}

type ParamGroup

type ParamGroup struct {
	Name      string
	Value     string
	NeedValue bool
}

type Program

type Program struct {
	Name        string
	Desc        string
	Usage       string
	Cmd         CMD
	ParamDefMap map[string]*ParamDef
	Target      string
}

Jump to

Keyboard shortcuts

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