merge

package
v0.0.0-...-5f60744 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: Apache-2.0 Imports: 22 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 {
		if ctx.Args().Len() < 1 {
			fmt.Printf("slim[%s]: missing target info...\n\n", Name)
			cli.ShowCommandHelp(ctx, Name)
			return nil
		}

		gfvalues, err := commands.GlobalFlagValues(ctx)
		if err != nil {
			return err
		}

		xc := app.NewExecutionContext(Name, ctx.String(commands.FlagConsoleFormat))

		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 *commands.GenericParams,
	cparams *CommandParams)

OnCommand implements the 'merge' command

func RegisterCommand

func RegisterCommand()

func TarTypeName

func TarTypeName(flag byte) string

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