Documentation ¶
Index ¶
- func GetDefaultCmdArgs(cmdName string) []string
- func GetExternalModuleDescription(module string) (string, error)
- func GetExternalModuleHelp(module string) (string, error)
- func RunCmd(cmdCtx *cmdcontext.CmdCtx, cmdName string, modulesInfo *ModulesInfo, ...) error
- func RunExec(command string, args []string) int
- type InternalFunc
- type ModuleInfo
- type ModulesInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultCmdArgs ¶
GetDefaultCmdArgs returns all arguments from the command line to external module that come after the command name.
func GetExternalModuleDescription ¶
GetExternalModuleDescription calls external module with the --help flag and returns an output.
func GetExternalModuleHelp ¶
GetExternalModuleHelp calls external module with the --help flag and returns an output.
func RunCmd ¶
func RunCmd(cmdCtx *cmdcontext.CmdCtx, cmdName string, modulesInfo *ModulesInfo, internal InternalFunc, args []string) error
RunCmd launches the required module. It collects a list of available modules, and based on flags and information about the modules, it launches the desired module.
If an external module is defined and the -I flag is not specified, the external module will be launched. In any other case, internal.
If the external module returns an error code, then tt exit with this code.
Types ¶
type InternalFunc ¶
type InternalFunc func(*cmdcontext.CmdCtx, []string) error
InternalFunc is a type of function that implements the external behavior of the module.
type ModuleInfo ¶
type ModuleInfo struct { // Is this module internal (or external). IsInternal bool // Path to module (used only is module external). ExternalPath string }
ModuleInfo stores information about Tarantool CLI module.
type ModulesInfo ¶
type ModulesInfo map[string]*ModuleInfo
ModulesInfo stores information about all CLI modules.
func GetModulesInfo ¶
func GetModulesInfo(cmdCtx *cmdcontext.CmdCtx, subCommands []*cobra.Command, cliOpts *config.CliOpts) (ModulesInfo, error)
GetModulesInfo collects information about available modules (both external and internal).