cmd

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: CC0-1.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version defines the application version (defined at compile time)
	Version = ""

	// Commit defines the application commit hash (defined at compile time)
	Commit = ""
)
View Source
var (
	FlagHome = "home"
)

Functions

func BuildDefaultExecutor

func BuildDefaultExecutor(config *Config) cli.Executor

BuildDefaultExecutor allows to build an Executor containing a root command that has the provided name and description and the default version and parse sub-commands implementations.

registrar will be used to register custom modules. Be sure to provide an implementation that returns all the modules that you want to use. If you don't want any custom module, use modules.EmptyRegistrar.

setupCfg method will be used to customize the SDK configuration. If you don't want any customization you can use the config.DefaultConfigSetup variable.

encodingConfigBuilder is used to provide a codec that will later be used to deserialize the transaction messages. Make sure you register all the types you need properly.

dbBuilder is used to provide the database that will be used to save the data. If you don't have any particular need, you can use the Create variable to build a default database instance.

func PrepareRootCmd

func PrepareRootCmd(name string, cmd *cobra.Command) cli.Executor

PrepareRootCmd is meant to prepare the given command binding all the viper flags

func RootCmd

func RootCmd(name string) *cobra.Command

RootCmd allows to build the default root command having the given name

func VersionCmd

func VersionCmd() *cobra.Command

VersionCmd returns the command that allows to show the version information

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config represents the general configuration for the commands

func NewConfig

func NewConfig(name string) *Config

NewConfig allows to build a new Config instance

func (*Config) GetInitConfig

func (c *Config) GetInitConfig() *initcmd.Config

GetInitConfig returns the currently set parse configuration

func (*Config) GetName

func (c *Config) GetName() string

GetName returns the name of the root command

func (*Config) GetParseConfig

func (c *Config) GetParseConfig() *parsecmd.Config

GetParseConfig returns the currently set parse configuration

func (*Config) WithInitConfig

func (c *Config) WithInitConfig(cfg *initcmd.Config) *Config

WithInitConfig sets cfg as the parse command configuration

func (*Config) WithParseConfig

func (c *Config) WithParseConfig(cfg *parsecmd.Config) *Config

WithParseConfig sets cfg as the parse command configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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