merge

package
v0.0.0-...-47a5711 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name  = "merge"
	Usage = "Merge two container images (optimized to merge minified images)"
	Alias = "m"
)
View Source
const (
	FlagImage                = "image"
	FlagUseLastImageMetadata = "use-last-image-metadata"
	FlagTag                  = "tag"
)

Merge command flag names

View Source
const (
	FlagImageUsage                = "Image to merge (flag instance position determines the merge order)"
	FlagUseLastImageMetadataUsage = "Use only the last image metadata for the merged image"
	FlagTagUsage                  = "Custom tags for the output image"
)

Merge command flag usage info

Variables

View Source
var CLI = &cli.Command{
	Name:    Name,
	Aliases: []string{Alias},
	Usage:   Usage,
	Flags: []cli.Flag{
		cflag(FlagImage),
		cflag(FlagUseLastImageMetadata),
		cflag(FlagTag),
	},
	Action: func(ctx *cli.Context) error {
		gfvalues := command.GlobalFlagValues(ctx)
		xc := app.NewExecutionContext(
			Name,
			gfvalues.QuietCLIMode,
			gfvalues.OutputFormat)

		if ctx.Args().Len() < 1 {
			xc.Out.Error("param.target", "missing target image ID/name")
			cli.ShowCommandHelp(ctx, Name)
			return nil
		}

		cfvalues, err := CommandFlagValues(xc, ctx)
		if err != nil {

			return nil
		}

		OnCommand(
			xc,
			gfvalues,
			cfvalues)

		return nil
	},
}
View Source
var CommandSuggestion = prompt.Suggest{
	Text:        Name,
	Description: Usage,
}
View Source
var Flags = map[string]cli.Flag{
	FlagImage: &cli.StringSliceFlag{
		Name:    FlagImage,
		Value:   cli.NewStringSlice(),
		Usage:   FlagImageUsage,
		EnvVars: []string{"DSLIM_MERGE_IMAGE"},
	},
	FlagUseLastImageMetadata: &cli.BoolFlag{
		Name:    FlagUseLastImageMetadata,
		Value:   false,
		Usage:   FlagUseLastImageMetadataUsage,
		EnvVars: []string{"DSLIM_MERGE_USE_LAST_IMAGE_META"},
	},
	FlagTag: &cli.StringSliceFlag{
		Name:    FlagTag,
		Value:   cli.NewStringSlice(),
		Usage:   FlagTagUsage,
		EnvVars: []string{"DSLIM_TARGET_TAG"},
	},
}

Functions

func OnCommand

func OnCommand(
	xc *app.ExecutionContext,
	gparams *command.GenericParams,
	cparams *CommandParams)

OnCommand implements the 'merge' command

func RegisterCommand

func RegisterCommand()

Types

type CommandParams

type CommandParams struct {
	FirstImage           string   `json:"first_image"`
	LastImage            string   `json:"last_image"`
	UseLastImageMetadata bool     `json:"use_last_image_metadata"`
	OutputTags           []string `json:"output_tags"`
}

func CommandFlagValues

func CommandFlagValues(xc *app.ExecutionContext, ctx *cli.Context) (*CommandParams, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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