cmd

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BuildVersion is the build version set by goreleaser
	BuildVersion = ""

	// BuildCommit is the git hash of the build. It is set by goreleaser
	BuildCommit = ""

	// BuildDate is the date the build was created. Its is set by goreleaser
	BuildDate = ""

	// GoVersion is the version of go used to build the client
	GoVersion = ""
)
View Source
var RootCmd = &cobra.Command{
	Use:   config.AppName,
	Short: "Kit is the official client for the MakeOS network",
	Long:  ``,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {

		setVersionInfo()

		preRunIgnoreList := []string{cmd.Root().Name()}
		if !funk.ContainsString(preRunIgnoreList, cmd.CalledAs()) {
			preRun(cmd)
		}
	},
	Run: func(cmd *cobra.Command, args []string) {
		version, _ := cmd.Flags().GetBool("version")
		if version {
			fmt.Println("Client:", BuildVersion)
			fmt.Println("Build:", BuildCommit)
			fmt.Println("Go:", GoVersion)
			if cfg.G().NodeKey != nil {
				fmt.Println("NodeID:", cfg.G().NodeKey.ID())
			}
			return
		}
		_ = cmd.Help()
	},
}

RootCmd represents the base command when called without any sub-commands

Functions

func Execute

func Execute()

Execute the root command or fallback command when command is unknown.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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