commands

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "supernova",
	Short: "Hotstuff2 state machine replication for applications in any programming languages",
	PersistentPreRunE: func(cmd *cobra.Command, _ []string) (err error) {
		if cmd.Name() == VersionCmd.Name() {
			return nil
		}

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

		InitLogger(config)

		return nil
	},
}

RootCmd is the root command for CometBFT core.

View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Show version info",
	Run: func(_ *cobra.Command, _ []string) {
		cmtVersion := version.CMTSemVer
		if version.CMTGitCommitHash != "" {
			cmtVersion += "+" + version.CMTGitCommitHash
		}

		if verbose {
			values, err := json.MarshalIndent(struct {
				CometBFT      string `json:"cometbft"`
				ABCI          string `json:"abci"`
				BlockProtocol uint64 `json:"block_protocol"`
				P2PProtocol   uint64 `json:"p2p_protocol"`
			}{
				CometBFT:      cmtVersion,
				ABCI:          version.ABCISemVer,
				BlockProtocol: version.BlockProtocol,
				P2PProtocol:   version.P2PProtocol,
			}, "", "  ")
			if err != nil {
				panic(fmt.Sprintf("failed to marshal version info: %v", err))
			}
			fmt.Println(string(values))
		} else {
			fmt.Println(cmtVersion)
		}
	},
}

VersionCmd ...

Functions

func AddNodeFlags

func AddNodeFlags(cmd *cobra.Command)

AddNodeFlags exposes some common configuration options on the command-line These are exposed for convenience of commands embedding a CometBFT node

func DefaultConfig

func DefaultConfig() *cmtcfg.Config

func InitLogger

func InitLogger(config *cmtcfg.Config)

func ParseConfig

func ParseConfig(cmd *cobra.Command) (*cmtcfg.Config, error)

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

func RunNodeCmd

func RunNodeCmd() *cobra.Command

Types

This section is empty.

Jump to

Keyboard shortcuts

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