Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClusterValidArgsFunction ¶
func ClusterValidArgsFunction( cmdCtx *cmdcontext.CmdCtx, cmd *cobra.Command, toComplete string, filter InstanceFilter, ) ([]string, cobra.ShellCompDirective)
ClusterValidArgsFunction completes the target of a cluster-level command, such as tt cluster show: an application, offered as it is, since a bare name is a target there, or one of its instances that filter keeps, as ValidArgsFunction offers them.
func ValidArgsFunction ¶
func ValidArgsFunction( cmdCtx *cmdcontext.CmdCtx, cmd *cobra.Command, toComplete string, filter InstanceFilter, ) ([]string, cobra.ShellCompDirective)
ValidArgsFunction completes the target of an instance command in the one form the usage and the errors give it, <APP>:<INSTANCE>, in the item of a comma-separated list being typed:
- before the colon, the applications a target may name, each followed by the colon: the project the command runs in and the applications of the system scope, or those of the scope --scope names when it is typed already (app.Names);
- after it, the instances of the pair of the application named, found as the command finds them, with --scope and --template, that filter keeps.
The selector * is not offered: a shell would expand it as a pattern. A failure to resolve completes nothing.
Types ¶
type InstanceFilter ¶
type InstanceFilter func(inst *running.InstanceCtx) bool
InstanceFilter keeps the instances a command completes: those it can act on, such as the running ones for tt instance stop.
var ( // Any keeps every instance. Any InstanceFilter = func(*running.InstanceCtx) bool { return true } // Active keeps the running instances. Active InstanceFilter = running.IsInstanceActive // Inactive keeps the instances that do not run. Inactive InstanceFilter = running.IsInstanceInactive )
The filters of the commands that complete instances.