cmd

package
v6.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: CC0-1.0 Imports: 16 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.

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
v3
v4

Jump to

Keyboard shortcuts

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