cmd

package
v3.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: BSD-2-Clause Imports: 96 Imported by: 0

Documentation

Index

Constants

View Source
const LegacyAnnotation = "tt.core/legacy"

LegacyAnnotation is the key of the command annotation that marks a top-level command built by this package - a builtin - rather than contributed by a module. Its value is "true".

Variables

This section is empty.

Functions

func Boot

func Boot(opts BootOptions) (*cobra.Command, error)

Boot creates the root command - the global flags, no subcommands - and makes it the process's root. It parses the global flags in opts.Args and installs the process logger they ask for. The root and the commands built after Boot present tt as opts.Flavour and have the integrity flags of opts.Integrity, the provider of the process from then on.

A flag error is not returned: Run reports it, once the logger is set up. An invalid --log-format leaves the default format in place until then.

func BuiltinCommands

func BuiltinCommands() []*cobra.Command

BuiltinCommands returns new instances of tt's top-level commands, each annotated with LegacyAnnotation.

func Configure

func Configure() error

Configure configures tt for the command line Boot parsed: it finds the project and the executables the commands run, and sets up the integrity checks. No configuration file of tt is read: tt.yaml is gone.

func ConfigureHelp

func ConfigureHelp(external []ExternalCommand)

ConfigureHelp sets up the help of the tree: the help command, which completes the names of the top-level commands, and the help templates. The root help lists external under EXTERNAL COMMANDS. The command tree must be complete.

func GetCmdCtxPtr

func GetCmdCtxPtr() *cmdcontext.CmdCtx

GetCmdCtxPtr returns a pointer to the context of the process, for the core to offer its services from.

func LoadApp

func LoadApp(ctx context.Context, appName string, lookup sdk.AppLookup) (*app.App, error)

LoadApp loads the application appName and its pair as the instance commands do, for the core: the project search starts in the directory the commands work in, the application is looked for and its pair chosen as lookup says, as --scope and --template of an instance command, and the files are read through the integrity checks.

func NewBackupCmd

func NewBackupCmd() *cobra.Command

NewBackupCmd creates the parent `tt backup` command.

func NewBackupIDCmd

func NewBackupIDCmd() *cobra.Command

NewBackupIDCmd creates `tt backup-id`.

func NewBinaryCmd

func NewBinaryCmd() *cobra.Command

NewBinaryCmd creates the command for managing binaries and SDK installations.

func NewCatCmd

func NewCatCmd() *cobra.Command

NewCatCmd creates a new cat command.

func NewCheckCmd

func NewCheckCmd() *cobra.Command

NewCheckCmd creates the check command of tt instance.

func NewCleanCmd

func NewCleanCmd() *cobra.Command

NewCleanCmd creates the clean command of tt instance.

func NewClusterCmd

func NewClusterCmd() *cobra.Command

func NewClusterTopologyCmd

func NewClusterTopologyCmd() *cobra.Command

NewClusterTopologyCmd creates the command that shows the current cluster topology.

func NewCompletionCmd

func NewCompletionCmd() *cobra.Command

NewCompletionCmd creates a new completion command.

func NewConnectCmd

func NewConnectCmd() *cobra.Command

NewConnectCmd creates tt connect, the documented facade of tt instance connect: the same command, with the same flags, which has no behaviour of its own.

func NewCoredumpCmd

func NewCoredumpCmd() *cobra.Command

NewCoredumpCmd creates coredump command.

func NewCreateCmd

func NewCreateCmd() *cobra.Command

NewCreateCmd creates an application from a template.

func NewDaemonCmd

func NewDaemonCmd() *cobra.Command

NewDaemonCmd creates daemon command.

func NewErrorsHelpTopic

func NewErrorsHelpTopic() *cobra.Command

NewErrorsHelpTopic creates the errors help topic, which explains the exit codes of tt commands. It has no Run, which is what makes it a help topic rather than a command: tt help errors prints it, and the command list leaves it out.

func NewInstanceCmd

func NewInstanceCmd() *cobra.Command

NewInstanceCmd creates the tt instance group: the commands that act on the processes of the instances of an application on this host.

func NewKillCmd

func NewKillCmd() *cobra.Command

NewKillCmd creates the kill command of tt instance.

func NewLogrotateCmd

func NewLogrotateCmd() *cobra.Command

NewLogrotateCmd creates the logrotate command of tt instance.

func NewLogsCmd

func NewLogsCmd() *cobra.Command

NewLogsCmd creates the logs command of tt instance.

func NewNewCmd

func NewNewCmd() *cobra.Command

NewNewCmd creates `tt new`: the skeleton app.manifest.toml a package starts from.

It is a top-level command rather than a `tt package` subcommand because it is what runs before a package exists — every `tt package` command reads the file this one writes.

func NewPackageCmd

func NewPackageCmd() *cobra.Command

NewPackageCmd creates the `tt package` command group: the manifest build pipeline (build, fetch and pack), the dependency-changing commands (add, remove and update), installation, and the inventory over what is installed (list and uninstall).

func NewPlayCmd

func NewPlayCmd() *cobra.Command

NewPlayCmd creates a new play command.

func NewRegistryCmd

func NewRegistryCmd() *cobra.Command

NewRegistryCmd creates the `tt registry` command group: the rock servers the package commands resolve against.

func NewReplicasetCmd

func NewReplicasetCmd() *cobra.Command

NewReplicasetCmd creates a replicaset command.

func NewRestartCmd

func NewRestartCmd() *cobra.Command

NewRestartCmd creates the restart command of tt instance.

func NewRestoreCmd

func NewRestoreCmd() *cobra.Command

NewRestoreCmd creates the parent `tt restore` command.

func NewRocksCmd

func NewRocksCmd() *cobra.Command

NewRocksCmd creates rocks command.

func NewRunCmd

func NewRunCmd() *cobra.Command

NewRunCmd creates `tt run`: the project's Tarantool, with the arguments passed straight through.

func NewServiceCmd

func NewServiceCmd() *cobra.Command

NewServiceCmd creates the tt service group: what ties the instances of applications to the service manager of the system.

func NewStartCmd

func NewStartCmd() *cobra.Command

NewStartCmd creates the start command of tt instance.

func NewStatusCmd

func NewStatusCmd() *cobra.Command

NewStatusCmd creates the status command of tt instance.

func NewStopCmd

func NewStopCmd() *cobra.Command

NewStopCmd creates the stop command of tt instance.

func NewTcmCmd

func NewTcmCmd() *cobra.Command

func NewTestCmd

func NewTestCmd() *cobra.Command

NewTestCmd creates `tt test`: build the package, then run its test suite under the same Tarantool tt run would choose.

func NewVersionCmd

func NewVersionCmd() *cobra.Command

NewVersionCmd creates a new version command.

func NewWasmCmd

func NewWasmCmd() *cobra.Command

NewWasmCmd creates the `tt wasm` command group.

func ProjectDir

func ProjectDir() (string, error)

ProjectDir returns the directory project commands work on, as an absolute path: the -C directory when one was given, and the working directory otherwise.

func Run

func Run() int

Run executes the command line on the root Boot created and returns the process exit code, having reported the error the command failed with.

Types

type BootOptions

type BootOptions struct {
	// Args are the command-line arguments, without the program name.
	Args []string
	// Flavour is how the distribution of tt presents itself. The zero
	// Flavour is tt's own.
	Flavour version.Flavour
	// Integrity is the integrity provider tt runs with: it registers the
	// integrity flags, checks the files and signs and verifies the data of
	// a configuration storage. Nil is the disabled provider, which checks
	// nothing and registers no flag.
	Integrity integrity.Provider
	// Modules are the modules the distribution is built from, as the table
	// of the core names them, for tt version --modules.
	Modules []version.Module
}

BootOptions configure Boot.

type ExternalCommand

type ExternalCommand struct {
	// Name is the command's name.
	Name string
	// Help is the module's one-line description.
	Help string
}

ExternalCommand is a top-level command that runs an external module, as the root help lists it under EXTERNAL COMMANDS.

Directories

Path Synopsis
Package clidoc renders the command reference of tt as Markdown pages from the command tree tt runs: a page for every top-level command, with its subcommands under it, a page for every help topic, and an index of them.
Package clidoc renders the command reference of tt as Markdown pages from the command tree tt runs: a page for every top-level command, with its subcommands under it, a page for every help topic, and an index of them.
Package helpgolden renders what tt prints for help and completion, for tests that pin it against a golden file: the --help of every command, the bash completion script and the completions of the first word.
Package helpgolden renders what tt prints for help and completion, for tests that pin it against a golden file: the --help of every command, the bash completion script and the completions of the first word.

Jump to

Keyboard shortcuts

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