xconsole

package
v0.3.15 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: BSD-3-Clause-Clear Imports: 10 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 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)    // 格式化文件的函数,若未注入则需要手动进行执行此命令

	DNS string // 默认DNS连接

	sync.Mutex // 内部路由锁
	// contains filtered or unexported fields
}

配置项

Jump to

Keyboard shortcuts

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