xconsole

package
v0.2.46 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: BSD-3-Clause-Clear Imports: 16 Imported by: 0

Documentation

Overview

命令行程序支持组件 此组件需要使用 xconsole.Listen() 来运行命令监听,即:

if len(os.Args) > 1 {
	xconsole.Listen()
	return
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listen

func Listen()

开始监听运行命令行程序

func Push

func Push(rou string, fun Command) error

推送任务到路由接口中

rou	执行的命令
fun	执行的命令内容

func PushMap

func PushMap(m map[string]Command) error

批量推送任务到路由接口中

m map结构的任务键值对

func Regedit

func Regedit(conf *Config)

注入配置

func SendEmail added in v0.1.29

func SendEmail(conf *EmailConfig) error

发送邮件

conf	发送邮件配置

func UnPush added in v0.2.24

func UnPush(rou []string) error

要移除的命令列表

Types

type Command

type Command func(help bool) string

命令支持的函数结构

type Config

type Config struct {
	Version       string                  // 外部版本标识
	Rout          map[string]Command      // 注入时直接携带路由进行注入
	WriteFileFunc func(name, body string) // 写入文件的函数,外部注册时可直接注册为:xfile.WriteString
	FmtFunc       func(file ...string)    // 格式化文件的函数,若未注入则需要手动进行执行此命令
	// contains filtered or unexported fields
}

配置项

type EmailConfig added in v0.1.29

type EmailConfig struct {
	MailHost       string   // 发件邮箱域名
	MailPort       int      // 发件邮箱端口
	MailUser       string   // 发件人
	MailName       string   // 发件人昵称
	MailPass       string   // 发件人密码
	MailAddress    string   // 收件人邮箱,多收件人使用 `,` 进行拼接
	MailCcAddress  string   // 抄送,多抄送人使用 `,` 进行拼接
	MailBccAddress string   // 暗送,多暗送人使用 `,` 进行拼接
	Subject        string   // 主题
	Body           string   // HTML内容
	Files          []string // 附件列表
}

发送邮件的配置信息

type Field added in v0.1.23

type Field struct {
	Field      string `gorm:"column:Field"`
	Type       string `gorm:"column:Type"`
	Null       string `gorm:"column:Null"`
	Key        string `gorm:"column:Key"`
	Default    string `gorm:"column:Default"`
	Extra      string `gorm:"column:Extra"`
	Privileges string `gorm:"column:Privileges"`
	Comment    string `gorm:"column:Comment"`
}

表字段

type Table added in v0.1.23

type Table struct {
	Name    string `gorm:"column:Name"`
	Comment string `gorm:"column:Comment"`
}

表注释

Jump to

Keyboard shortcuts

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