app

package
v0.0.0-...-b9554ab Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

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
			},
		},
	},
}

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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