Back to godoc.org

Package commands

v0.0.6
Latest Go to latest

The highest tagged major version is .

Published: Sep 25, 2019 | License: Apache-2.0 | Module: github.com/QOSGroup/qmoon

Index

Variables

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

DoctorCmd 健康检查

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

InitFilesCmd initialises a fresh Tendermint Core instance.

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

MigrationCmd 数据库初始化命令

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

NodeCmd 数据库初始化命令

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主命令

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

ServerCmd qmoon http server

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

TxCmd 交易解析

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

VersionCmd qmoon 版本

func ParseConfig

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

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

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier