commands

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package commands 实现命令行应用基本命令

定义 Root 命令(默认命令)以实现默认功能(显示帮助信息),并实现预处理功能。

定义 $> cassini start 命令(服务启动命令)以实现服务启动,并根据配置运行服务。

定义 $> cassini mock 命令(Mock服务启动命令)以实现Mock服务启动,并根据配置运行Mock服务,以便于进行服务相关测试。

定义 $> cassini wsclient 启动WebSocket客户端,以监听服务端交易事件,进行相关测试。

Index

Constants

View Source
const (
	// CommandStart cli command "start"
	CommandStart = "start"

	// CommandMock cli command "mock"
	CommandMock = "mock"

	// CommandEvents cli command "events"
	CommandEvents = "events"

	// CommandTx cli command "tx"
	CommandTx = "tx"

	// CommandVersion cli command "version"
	CommandVersion = "version"
)
View Source
const (

	// DefaultEventSubscribe events 默认订阅条件
	DefaultEventSubscribe string = "tm.event='Tx' AND qcp.to='qos'"
)

Variables

This section is empty.

Functions

func NewEventsCommand

func NewEventsCommand(run Runner, isKeepRunning bool) *cobra.Command

NewEventsCommand 创建 events 命令

func NewMockCommand

func NewMockCommand(run Runner, isKeepRunning bool) *cobra.Command

NewMockCommand 创建 mock/模拟服务 命令

func NewRootCommand

func NewRootCommand() *cobra.Command

NewRootCommand 创建 root/默认 命令

实现默认功能,显示帮助信息,预处理配置初始化,日志配置初始化。

func NewStartCommand

func NewStartCommand(run Runner, isKeepRunning bool) *cobra.Command

NewStartCommand 创建 start/服务启动 命令

func NewTxCommand

func NewTxCommand(run Runner, isKeepRunning bool) *cobra.Command

NewTxCommand 创建 tx 命令

func NewVersionCommand

func NewVersionCommand(run Runner, isKeepRunning bool) *cobra.Command

Types

type Runner

type Runner func(conf *config.Config) (context.CancelFunc, error)

Runner 通过配置数据执行方法,返回运行过程中出现的错误,如果返回空则代表运行成功。

Jump to

Keyboard shortcuts

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