cli

package
v0.0.0-...-20ba4cd Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 30 Imported by: 2

Documentation

Index

Constants

View Source
const (
	KB = 1000
	MB = 1000 * 1000
	GB = 1000 * 1000 * 1000
	TB = 1000 * 1000 * 1000 * 1000
)
View Source
const CustomSubcommandHelpTemplate = `` /* 574-byte string literal not displayed */

SubcommandHelpTemplate is the text template for the subcommand help topic. cli.go uses text/template to render templates. This template is used for sub-commands with one or more required flags present.

View Source
const LatestFormatVersion = 3

LatestFormatVersion is the latest version of the format, which is also what we default to.

Variables

Log is a global reference to our logger.

View Source
var Version = "unknown"

Version of the mender-artifact CLI tool

Functions

func Cat

func Cat(c *cli.Context) (err error)

func CheckArtifactSize

func CheckArtifactSize(outputPath string, ctx *cli.Context) error

CheckArtifactSize checks the Artifact file size against configured limits Returns error if max limit exceeded (and deletes file) Logs warning if warn limit exceeded (keeps file)

func Copy

func Copy(c *cli.Context) (err error)

func CopyFromImage

func CopyFromImage(image VPImage, imageFile string, hostFile string) error

Shortcut to open a file in the image, read from it, and close it again.

func CopyIntoImage

func CopyIntoImage(hostFile string, image VPImage, imageFile string) error

Shortcut to open a file in the image, write into it, and close it again.

func CopyOwner

func CopyOwner(tFile *os.File, artFile string) error

func DumpCommand

func DumpCommand(c *cli.Context) error

func FormatSize

func FormatSize(bytes int64) string

FormatSize formats bytes into human-readable format Examples: 5000000 -> "5.0 MB", 1500000000 -> "1.5 GB"

func Install

func Install(c *cli.Context) (err error)

Install installs a file from the host filesystem or directory onto either a mender artifact, or an sdimg.

func ParseSizeLimit

func ParseSizeLimit(sizeStr string) (int64, error)

ParseSizeLimit parses size strings like "5MB", "1.5GB", "100" Supports: B, KB, MB, GB, TB (decimal, base 1000) Case-insensitive, allows decimals (1.5MB), bare numbers (5000000)

func Remove

func Remove(c *cli.Context) (err error)

func Run

func Run(args []string) error

Types

type ModImageArtifact

type ModImageArtifact struct {
	ModImageBase
	// contains filtered or unexported fields
}

func (*ModImageArtifact) Close

func (i *ModImageArtifact) Close() error

Closes and repacks the artifact or sdimg.

func (*ModImageArtifact) Open

func (i *ModImageArtifact) Open(fpath string) (VPFile, error)

Opens a file inside the image(s) represented by the ModImageArtifact

func (*ModImageArtifact) OpenDir

func (i *ModImageArtifact) OpenDir(fpath string) (VPDir, error)

Opens a dir inside the image(s) represented by the ModImageArtifact

type ModImageBase

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

type ModImageRaw

type ModImageRaw struct {
	ModImageBase
}

func (*ModImageRaw) Close

func (i *ModImageRaw) Close() error

func (*ModImageRaw) Open

func (i *ModImageRaw) Open(fpath string) (VPFile, error)

func (*ModImageRaw) OpenDir

func (i *ModImageRaw) OpenDir(fpath string) (VPDir, error)

type ModImageSdimg

type ModImageSdimg struct {
	ModImageBase
	// contains filtered or unexported fields
}

func (*ModImageSdimg) Close

func (i *ModImageSdimg) Close() error

func (*ModImageSdimg) Open

func (i *ModImageSdimg) Open(fpath string) (VPFile, error)

Opens a file inside the image(s) represented by the ModImageSdimg

func (*ModImageSdimg) OpenDir

func (i *ModImageSdimg) OpenDir(fpath string) (VPDir, error)

type SigningKey

type SigningKey interface {
	artifact.Signer
	artifact.Verifier
}

type VPDir

type VPDir interface {
	io.Closer
	Create() error
}

VPDir V(irtual)P(artition)Dir mimics a directory in an Artifact or on an sdimg.

type VPFile

type VPFile interface {
	io.ReadWriteCloser
	Delete(recursive bool) error
	CopyTo(hostFile string) error
	CopyFrom(hostFile string) error
}

V(irtual)P(artition)File mimicks a file in an Artifact or on an sdimg.

type VPImage

type VPImage interface {
	io.Closer
	Open(fpath string) (VPFile, error)
	OpenDir(fpath string) (VPDir, error)
	// contains filtered or unexported methods
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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