images

package
v0.0.0-...-69654ca Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name  = string(cmd.Images)
	Usage = "Get information about container images"
	Alias = "i"
)
View Source
const (
	FlagFilter      = "filter"
	FlagFilterUsage = "container image filter pattern"
	// TODO - replace with reference to `master/command.FlagTUI`
	FlagTUI      = "tui"
	FlagTUIUsage = "terminal user interface"
)

Images command flag names and usage descriptions

Variables

View Source
var (
	// HeaderStyle is the lipgloss style used for the table headers.
	HeaderStyle = lipgloss.NewStyle().Foreground(white).Bold(true).Align(lipgloss.Center)
	// CellStyle is the base lipgloss style used for the table rows.
	CellStyle = lipgloss.NewStyle().Padding(0, 1).Width(14)
	// OddRowStyle is the lipgloss style used for odd-numbered table rows.
	OddRowStyle = CellStyle.Foreground(gray)
	// EvenRowStyle is the lipgloss style used for even-numbered table rows.
	EvenRowStyle = CellStyle.Foreground(lightGray)
	// BorderStyle is the lipgloss style used for the table border.
	BorderStyle = lipgloss.NewStyle().Foreground(white)
)
View Source
var CLI = &cli.Command{
	Name:    Name,
	Aliases: []string{Alias},
	Usage:   Usage,
	Flags:   ImagesFlags,
	Action: func(ctx *cli.Context) error {
		gcvalues, ok := command.CLIContextGet(ctx.Context, command.GlobalParams).(*command.GenericParams)
		if !ok || gcvalues == nil {
			return command.ErrNoGlobalParams
		}

		tuiMode := ctx.Bool(FlagTUI)
		cparams := &CommandParams{
			Runtime: ctx.String(command.FlagRuntime),
			Filter:  ctx.String(FlagFilter),
			TUI:     tuiMode,
		}

		quietLogs := tuiMode || gcvalues.QuietCLIMode

		xc := app.NewExecutionContext(
			Name,
			quietLogs,
			gcvalues.OutputFormat)

		OnCommand(xc, gcvalues, cparams)
		return nil
	},
}
View Source
var CommandFlagSuggestions = &command.FlagSuggestions{
	Names: []prompt.Suggest{
		{Text: command.FullFlagName(command.FlagRuntime), Description: command.FlagRuntimeUsage},
		{Text: command.FullFlagName(FlagFilter), Description: FlagFilterUsage},
	},
	Values: map[string]command.CompleteValue{
		command.FullFlagName(command.FlagRuntime): command.CompleteRuntime,
	},
}
View Source
var CommandSuggestion = prompt.Suggest{
	Text:        Name,
	Description: Usage,
}
View Source
var Flags = map[string]cli.Flag{
	FlagFilter: &cli.StringFlag{
		Name:    FlagFilter,
		Value:   "",
		Usage:   FlagFilterUsage,
		EnvVars: []string{"DSLIM_IMAGES_FILTER"},
	},
	FlagTUI: &cli.BoolFlag{
		Name:  FlagTUI,
		Usage: FlagTUIUsage,
	},
}
View Source
var ImagesFlags = []cli.Flag{
	command.Cflag(command.FlagRuntime),
	cflag(FlagFilter),
	cflag(FlagTUI),
}

Functions

func OnCommand

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

OnCommand implements the 'images' command

func RegisterCommand

func RegisterCommand()

Types

type CommandParams

type CommandParams struct {
	Runtime   string `json:"runtime,omitempty"`
	Filter    string `json:"filter,omitempty"`
	TUI       bool   `json:"tui,omitempty"`
	GlobalTUI bool   `json:"globalTui,omitempty"`
}

type TUI

type TUI struct {
	// contains filtered or unexported fields
}

TUI represents the internal state of the terminal user interface.

func InitialTUI

func InitialTUI(images map[string]crt.BasicImageInfo, standalone bool) *TUI

InitialTUI returns the initial state of the TUI.

func LoadTUI

func LoadTUI() *TUI

func (TUI) Init

func (m TUI) Init() tea.Cmd

func (TUI) Update

func (m TUI) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update is called to handle user input and update the TUI's state.

func (TUI) View

func (m TUI) View() string

View returns the view that should be displayed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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