Documentation
¶
Index ¶
- Variables
- func CommandDisplay(cmd string, args []flags.Arg) string
- func ResolveApp(ui terminal.UI, client realm.Client, filter realm.AppFilter) (realm.App, error)
- func ResolveGroupID(ui terminal.UI, client atlas.Client) (string, error)
- type Clients
- type Command
- type CommandDefinition
- type CommandFactory
- type CommandFlags
- type CommandInputs
- type CommandMeta
- type DisableUsage
- type ErrAppNotFound
- type InputResolver
- type LinkReferrer
- type ProjectInputs
- type Suggester
- type VersionManifestClient
Constants ¶
This section is empty.
Variables ¶
var ( // Name represents the CLI name; used for invoking the CLI commands Name = "realm-cli" // Version represents the CLI version Version = "0.0.0" // value will be injected at build-time )
var (
ErrGroupNotFound = errors.New("failed to find group")
)
set of known app input errors
Functions ¶
func CommandDisplay ¶
CommandDisplay returns the command display with the provided flags
func ResolveApp ¶
ResolveApp will use the provided Realm client to resolve the app specified by the filter
Types ¶
type Command ¶
Command is an executable CLI command This interface maps 1:1 to Cobra's Command.RunE phase
Optionally, a Command may implement any of the other interfaces found below. The order of operations is:
- CommandFlagger.Flags: use this hook to register flags to parse
- CommandInputs.Resolve: use this hook to prompt for any flags not provided
- CommandPreparer.Setup: use this hook to use setup the command (e.g. create clients/services)
- Command.Handler: this is the command hook
At any point should an error occur, command execution will terminate and the ensuing steps will not be run
type CommandDefinition ¶
type CommandDefinition struct {
CommandMeta
// Command is the command's implementation
// If present, this value is used to specify the cobra.Command execution phases
Command Command
// SubCommands are the command's sub commands
// This array is iteratively added to this Cobra command via (cobra.Command).AddCommand
SubCommands []CommandDefinition
}
CommandDefinition is a command's definition that the CommandFactory can build a *cobra.Command from
type CommandFactory ¶
type CommandFactory struct {
// contains filtered or unexported fields
}
CommandFactory is a command factory
func NewCommandFactory ¶
func NewCommandFactory() (*CommandFactory, error)
NewCommandFactory creates a new command factory
func (*CommandFactory) Build ¶
func (factory *CommandFactory) Build(command CommandDefinition) *cobra.Command
Build builds a Cobra command from the specified CommandDefinition
func (*CommandFactory) Run ¶
func (factory *CommandFactory) Run(cmd *cobra.Command) int
Run executes the command
func (*CommandFactory) SetGlobalFlags ¶
func (factory *CommandFactory) SetGlobalFlags(fs *pflag.FlagSet)
SetGlobalFlags sets the global flags
func (*CommandFactory) Setup ¶
func (factory *CommandFactory) Setup()
Setup initializes the command factory
type CommandFlags ¶
CommandFlags provides access for commands to register local flags
type CommandInputs ¶
type CommandInputs interface {
Inputs() InputResolver
}
CommandInputs returns the command inputs
type CommandMeta ¶
type CommandMeta struct {
// Use defines how the command is used
// This value maps 1:1 to Cobra's `Use` property
Use string
// Display controls how the command is described in output
// If left blank, the command's Use value will be used instead
Display string
// Aliases is the list of supported aliases for the command
// This value maps 1:1 to Cobra's `Aliases` property
Aliases []string
// Description is the text shown in the 'help' output of the parent command
Description string
// HelpText is the text shown in the 'help' output of the actual command
// right below the command's description
HelpText string
}
CommandMeta is the command metadata
type DisableUsage ¶
type DisableUsage interface {
DisableUsage() struct{}
}
DisableUsage disables the usage printing when an error occurs
type ErrAppNotFound ¶
type ErrAppNotFound struct {
App string
}
ErrAppNotFound is an app not found error
func (ErrAppNotFound) Error ¶
func (err ErrAppNotFound) Error() string
type InputResolver ¶
InputResolver provides access for command inputs to resolve missing data
type LinkReferrer ¶
type LinkReferrer interface {
ReferenceLinks() []interface{}
}
LinkReferrer provides a list of reference links that will display to the user when an error occurs
type ProjectInputs ¶
ProjectInputs are the project/app inputs for a command
func (ProjectInputs) Filter ¶
func (i ProjectInputs) Filter() realm.AppFilter
Filter returns a realm.AppFlter based on the inputs
func (*ProjectInputs) Flags ¶
func (i *ProjectInputs) Flags(fs *pflag.FlagSet)
Flags registers the project app input flags to the provided flag set