cmd

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package cmd 命令行辅助方法

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(c Commander)

func Error

func Error(msg string)

Error 打印一条报错消息,红色输出

func Exit

func Exit(msg string)

Exit 打印一条报错消息,并退出 os.Exit(1)

func ExitIf

func ExitIf(err error)

ExitIf 语法糖,自带 err != nil 判断

func List

func List() (cmdList []cli.Command)

func ScheduleCommandList

func ScheduleCommandList() *[]*ScheduleCommand

func Success

func Success(msg string)

Success 打印一条成功消息,绿色输出

func Warning

func Warning(msg string)

Warning 打印一条提示消息,黄色输出

Types

type Arg

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

func (*Arg) Get

func (a *Arg) Get(argName string) (data *string, err error)

type Commander

type Commander interface {
	Command() string
	Description() string
	Handler(arg *Arg) error
}

type Job

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

func NewJob

func NewJob(scmd *ScheduleCommand) *Job

func (*Job) Run

func (j *Job) Run()

type Model

type Model struct {
}

func (*Model) CreateFileFromStub

func (s *Model) CreateFileFromStub(filePath string, stubName string, model Models, variables ...interface{})

CreateFileFromStub 读取 stub 文件并进行变量替换 最后一个选项可选,如若传参,应传 map[string]string 类型,作为附加的变量搜索替换

func (*Model) MakeModelFromString

func (s *Model) MakeModelFromString(appname string, name string) Models

MakeModelFromString 格式化用户输入的内容

type Models

type Models struct {
	AppName            string
	TableName          string
	StructName         string
	StructNamePlural   string
	VariableName       string
	VariableNamePlural string
	PackageName        string
	ModelFileName      string
	ServiceName        string
	RepositoriesName   string
}

type Schedule

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

func NewSchedule

func NewSchedule() *Schedule

func (*Schedule) Command

func (s *Schedule) Command(commandWithArgData string) *ScheduleCommand

type ScheduleCommand

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

func (*ScheduleCommand) Daily

func (sc *ScheduleCommand) Daily()

func (*ScheduleCommand) EveryDays

func (sc *ScheduleCommand) EveryDays(d uint)

func (*ScheduleCommand) EveryHours

func (sc *ScheduleCommand) EveryHours(h uint)

func (*ScheduleCommand) EveryMinute

func (sc *ScheduleCommand) EveryMinute()

func (*ScheduleCommand) EveryMinutes

func (sc *ScheduleCommand) EveryMinutes(m uint)

func (*ScheduleCommand) EverySecond

func (sc *ScheduleCommand) EverySecond()

func (*ScheduleCommand) EverySeconds

func (sc *ScheduleCommand) EverySeconds(s uint)

func (*ScheduleCommand) Hourly

func (sc *ScheduleCommand) Hourly()

func (*ScheduleCommand) Monthly

func (sc *ScheduleCommand) Monthly()

func (*ScheduleCommand) When

func (sc *ScheduleCommand) When() schedule.When

func (*ScheduleCommand) Yearly

func (sc *ScheduleCommand) Yearly()

Directories

Path Synopsis
commands
job
mq

Jump to

Keyboard shortcuts

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