Documentation
¶
Index ¶
- Constants
- Variables
- func OnBomCommand(xc *a.ExecutionContext, gparams *command.GenericParams)
- func OnInstallCommand(xc *a.ExecutionContext, gparams *command.GenericParams, ...)
- func OnInstallDCPCommand(xc *a.ExecutionContext, gparams *command.GenericParams)
- func OnRsvCommand(xc *a.ExecutionContext, gparams *command.GenericParams)
- func OnUpdateCommand(xc *a.ExecutionContext, gparams *command.GenericParams, ...)
- func OnVersionCommand(xc *a.ExecutionContext, gparams *command.GenericParams)
- func RegisterCommand()
- type CommonCommandParams
- type InstallCommandParams
- type UpdateCommandParams
Constants ¶
View Source
const ( Name = string(cmd.App) Usage = "Execute app management, maintenance, debugging and query operations" Alias = "a" BomCmdName = "bom" BomCmdNameUsage = "Show application BOM" VersionCmdName = "version" VersionCmdNameUsage = "Shows mint and container runtime version information" RSVCmdName = "remove-sensor-volumes" RSVCmdNameUsage = "Remove all available sensor volumes" UpdateCmdName = "update" UpdateCmdNameUsage = "Update app to the latest version" InstallCmdName = "install" InstallCmdNameUsage = "Copy Mint binaries from current location to the standard user app bin directory (/usr/local/bin)" InstallDCPCmdName = "install-docker-cli-plugin" InstallDCPCmdNameUsage = "Install Docker CLI plugin for Mint" )
View Source
const ( FlagX = "x" FlagXUsage = "usage" )
App command flags
Variables ¶
View Source
var CLI = &cli.Command{ Name: Name, Aliases: []string{Alias}, Usage: Usage, Flags: []cli.Flag{}, Subcommands: []*cli.Command{ { Name: BomCmdName, Usage: BomCmdNameUsage, Flags: []cli.Flag{}, Action: func(ctx *cli.Context) error { gcvalues, ok := command.CLIContextGet(ctx.Context, command.GlobalParams).(*command.GenericParams) if !ok || gcvalues == nil { return command.ErrNoGlobalParams } xc := a.NewExecutionContext( fullCmdName(BomCmdName), gcvalues.QuietCLIMode, gcvalues.OutputFormat) OnBomCommand(xc, gcvalues) return nil }, }, { Name: VersionCmdName, Usage: VersionCmdNameUsage, Flags: []cli.Flag{}, Action: func(ctx *cli.Context) error { gcvalues, ok := command.CLIContextGet(ctx.Context, command.GlobalParams).(*command.GenericParams) if !ok || gcvalues == nil { return command.ErrNoGlobalParams } xc := a.NewExecutionContext( fullCmdName(VersionCmdName), gcvalues.QuietCLIMode, gcvalues.OutputFormat) OnVersionCommand(xc, gcvalues) return nil }, }, { Name: RSVCmdName, Usage: RSVCmdNameUsage, Flags: []cli.Flag{}, Action: func(ctx *cli.Context) error { gcvalues, ok := command.CLIContextGet(ctx.Context, command.GlobalParams).(*command.GenericParams) if !ok || gcvalues == nil { return command.ErrNoGlobalParams } xc := a.NewExecutionContext( fullCmdName(RSVCmdName), gcvalues.QuietCLIMode, gcvalues.OutputFormat) OnRsvCommand(xc, gcvalues) return nil }, }, { Name: UpdateCmdName, Usage: UpdateCmdNameUsage, Flags: []cli.Flag{ initFlagShowProgress(), }, Action: func(ctx *cli.Context) error { gcvalues, ok := command.CLIContextGet(ctx.Context, command.GlobalParams).(*command.GenericParams) if !ok || gcvalues == nil { return command.ErrNoGlobalParams } xc := a.NewExecutionContext( fullCmdName(UpdateCmdName), gcvalues.QuietCLIMode, gcvalues.OutputFormat) cparams, err := UpdateCommandFlagValues(ctx) xc.FailOn(err) OnUpdateCommand(xc, gcvalues, cparams) return nil }, }, { Name: InstallCmdName, Usage: InstallCmdNameUsage, Flags: []cli.Flag{}, Action: func(ctx *cli.Context) error { gcvalues, ok := command.CLIContextGet(ctx.Context, command.GlobalParams).(*command.GenericParams) if !ok || gcvalues == nil { return command.ErrNoGlobalParams } xc := a.NewExecutionContext( fullCmdName(InstallCmdName), gcvalues.QuietCLIMode, gcvalues.OutputFormat) cparams, err := InstallCommandFlagValues(ctx) xc.FailOn(err) OnInstallCommand(xc, gcvalues, cparams) return nil }, }, { Name: InstallDCPCmdName, Usage: InstallDCPCmdNameUsage, Flags: []cli.Flag{}, Action: func(ctx *cli.Context) error { gcvalues, ok := command.CLIContextGet(ctx.Context, command.GlobalParams).(*command.GenericParams) if !ok || gcvalues == nil { return command.ErrNoGlobalParams } xc := a.NewExecutionContext( fullCmdName(InstallDCPCmdName), gcvalues.QuietCLIMode, gcvalues.OutputFormat) OnInstallDCPCommand(xc, gcvalues) return nil }, }, }, }
View Source
var CommandFlagSuggestions = &command.FlagSuggestions{ Names: []prompt.Suggest{ {Text: command.FullFlagName(command.FlagShowProgress), Description: command.FlagShowProgressUsage}, }, Values: map[string]command.CompleteValue{ command.FullFlagName(command.FlagShowProgress): command.CompleteProgress, }, }
TODO: need to improve flag prompting to work with sub-commands properly
View Source
var CommandSuggestion = prompt.Suggest{ Text: Name, Description: Usage, }
View Source
var Flags = map[string]cli.Flag{}
Functions ¶
func OnBomCommand ¶
func OnBomCommand( xc *a.ExecutionContext, gparams *command.GenericParams)
OnBomCommand implements the 'app bom' command
func OnInstallCommand ¶
func OnInstallCommand( xc *a.ExecutionContext, gparams *command.GenericParams, cparams *InstallCommandParams)
OnInstallCommand implements the 'app install' command
func OnInstallDCPCommand ¶
func OnInstallDCPCommand( xc *a.ExecutionContext, gparams *command.GenericParams)
OnInstallDCPCommand implements the 'app install-docker-cli-plugin' command
func OnRsvCommand ¶
func OnRsvCommand( xc *a.ExecutionContext, gparams *command.GenericParams)
OnRsvCommand implements the 'app remove-sensor-volumes' command
func OnUpdateCommand ¶
func OnUpdateCommand( xc *a.ExecutionContext, gparams *command.GenericParams, cparams *UpdateCommandParams)
OnUpdateCommand implements the 'app update' command
func OnVersionCommand ¶
func OnVersionCommand( xc *a.ExecutionContext, gparams *command.GenericParams)
OnVersionCommand implements the 'app version' command
func RegisterCommand ¶
func RegisterCommand()
Types ¶
type CommonCommandParams ¶
type CommonCommandParams struct {
}
func CommonCommandFlagValues ¶
func CommonCommandFlagValues(ctx *cli.Context) (*CommonCommandParams, error)
type InstallCommandParams ¶
type InstallCommandParams struct {
*CommonCommandParams
}
func InstallCommandFlagValues ¶
func InstallCommandFlagValues(ctx *cli.Context) (*InstallCommandParams, error)
type UpdateCommandParams ¶
type UpdateCommandParams struct {
*CommonCommandParams
ShowProgress bool
}
func UpdateCommandFlagValues ¶
func UpdateCommandFlagValues(ctx *cli.Context) (*UpdateCommandParams, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.