commands

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DoctorCmd = &cobra.Command{
	Use:   "doctor",
	Short: "健康检查",
	RunE:  doctor,
}

DoctorCmd 健康检查

View Source
var (
	HomeFlag = "home"
)
View Source
var InitFilesCmd = &cobra.Command{
	Use:   "init",
	Short: "Initialize qmood",
	RunE:  initFiles,
}

InitFilesCmd initialises a fresh Tendermint Core instance.

View Source
var MigrationCmd = &cobra.Command{
	Use:   "migration up",
	Short: "migration",
	RunE:  migration,
}

MigrationCmd 数据库初始化命令

View Source
var NodeCmd = &cobra.Command{
	Use:   "node",
	Short: "node 管理",
}

NodeCmd 数据库初始化命令

View Source
var RootCmd = &cobra.Command{
	Use:   "qmoon",
	Short: "qmoon cli",
	PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) {
		if cmd.Name() == VersionCmd.Name() {
			return nil
		}

		if err := viper.BindPFlags(cmd.Flags()); err != nil {
			return err
		}

		homeDir := viper.GetString(HomeFlag)
		viper.Set(HomeFlag, homeDir)
		viper.SetConfigName("config")
		viper.AddConfigPath(homeDir)
		viper.AddConfigPath(filepath.Join(homeDir, "config"))

		if err := viper.ReadInConfig(); err == nil {

		} else if _, ok := err.(viper.ConfigFileNotFoundError); !ok {

			return err
		}

		config, err = ParseConfig()
		if err != nil {
			return err
		}

		if config.LogLevel == "debug" {
			logrus.SetLevel(logrus.DebugLevel)
		}

		if err := models.InitDb(config.DB); err != nil {
			return err
		}

		return nil
	},
}

RootCmd moon主命令

View Source
var ServerCmd = &cobra.Command{
	Use:   "server",
	Short: "restful api server",
	RunE:  server,
}

ServerCmd qmoon http server

View Source
var TxCmd = &cobra.Command{
	Use:   "tx",
	Short: "解析块里的交易",
	RunE:  txParse,
}

TxCmd 交易解析

View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Show version info",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println(version.Version)
	},
}

VersionCmd qmoon 版本

Functions

func ParseConfig

func ParseConfig() (*cfg.Config, error)

ParseConfig retrieves the default environment configuration, sets up the Tendermint root and ensures that the root exists

Types

This section is empty.

Jump to

Keyboard shortcuts

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