modules

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultCmdArgs

func GetDefaultCmdArgs(cmdName string) []string

GetDefaultCmdArgs returns all arguments from the command line to external module that come after the command name.

func GetExternalModuleDescription

func GetExternalModuleDescription(module string) (string, error)

GetExternalModuleDescription calls external module with the --help flag and returns an output.

func GetExternalModuleHelp

func GetExternalModuleHelp(module string) (string, error)

GetExternalModuleHelp calls external module with the --help flag and returns an output.

func RunCmd

func RunCmd(cmdCtx *cmdcontext.CmdCtx, cmdPath 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.

func RunExec

func RunExec(command string, args []string) int

RunExec exec command with the supplied arguments. returns an error code from exec command.

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, rootCmd *cobra.Command,
	cliOpts *config.CliOpts) (ModulesInfo, error)

GetModulesInfo collects information about available modules (both external and internal).

Jump to

Keyboard shortcuts

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