cmd

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: BSD-3-Clause Imports: 37 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// Generic error code
	ExitCodeError = 1
	// Wrong or missing arguments (misuse of command)
	ExitCodeUsage = 2
	// Returned when jobs were submitted to a scheduler (overlays will be created asynchronously)
	ExitCodeJobsSubmitted = 3
)

Exit codes used by various commands

Variables

View Source
var ForceRefreshHelpers bool

ForceRefreshHelpers skips the helper metadata disk cache when set.

Functions

func Execute

func Execute()

func ExitIfJobsSubmitted added in v1.1.1

func ExitIfJobsSubmitted(graph *build.BuildGraph)

ExitIfJobsSubmitted exits the process with ExitCodeJobsSubmitted if a scheduler submission was requested and the graph shows job IDs were created.

func ExitWithError added in v1.1.1

func ExitWithError(format string, a ...interface{})

ExitWithError prints an error and exits with ExitCodeError

func ExitWithUsageError added in v1.3.0

func ExitWithUsageError(format string, a ...interface{})

ExitWithUsageError prints an error and exits with ExitCodeUsage (2)

func GetAllRemoteHelperMetadata added in v1.3.0

func GetAllRemoteHelperMetadata() (map[string]map[string]HelperScriptEntry, error)

GetAllRemoteHelperMetadata merges helper metadata from all configured remote URLs. Earlier URLs in ScriptsLinks take precedence (first match per category/name wins).

func KnownFlags added in v1.1.1

func KnownFlags() map[string]bool

KnownFlags returns a map of all known condatainer flags

func ParseCommandArgs added in v1.1.1

func ParseCommandArgs(subcommand string) ([]string, []string)

ParseCommandArgs parses arguments from os.Args after a given subcommand Returns: commands (positional args), apptainerFlags (unknown flags for apptainer)

func ParseInstanceArgs added in v1.1.1

func ParseInstanceArgs(subcommand string) (string, []string)

ParseInstanceArgs parses arguments for instance start/run commands Returns: instanceName, apptainerFlags

func PrepareCommandAndHidePrompt added in v1.1.1

func PrepareCommandAndHidePrompt(commands []string) ([]string, bool)

PrepareCommandAndHidePrompt prepares the command array and determines if prompt should be hidden If commands is empty, defaults to ["bash"] with hidePrompt=false If commands has 1 element, returns hidePrompt=false Otherwise returns hidePrompt=true

func RegisterCommonFlags added in v1.1.1

func RegisterCommonFlags(cmd *cobra.Command, flags *CommonFlags)

RegisterCommonFlags registers common flags on a cobra command

func ResolveBaseImage added in v1.1.1

func ResolveBaseImage(baseImage string) string

ResolveBaseImage resolves a base image path to an absolute path Returns empty string if baseImage is empty

Types

type CommonFlags added in v1.1.1

type CommonFlags struct {
	Overlays    []string
	WritableImg bool
	EnvSettings []string
	BaseImage   string
	BindPaths   []string
	Fakeroot    bool
}

CommonFlags holds the common flags used by exec, instance start, and instance exec

type DirOverlays added in v1.4.0

type DirOverlays struct {
	Dir       string
	AppGroups map[string][]string // name → sorted []version
	DataList  []string
	Paths     map[string]string // normalized name/version → full overlay path
}

DirOverlays holds the scan results for a single image directory.

type HelperScriptEntry

type HelperScriptEntry struct {
	Path      string `json:"path"`
	SourceURL string `json:"-"` // injected during merge; not stored in remote JSON
}

HelperScriptEntry represents a helper script metadata entry.

type PackageInfo

type PackageInfo struct {
	Name           string              // name/version format
	Path           string              // full path to build script
	IsContainer    bool                // true if .def file
	IsInstalled    bool                // true if overlay exists
	IsRemote       bool                // true if from remote repository
	IsTemplate     bool                // true if script has #PL: placeholders
	Whatis         string              // description string
	TargetTemplate string              // raw #TARGET: pattern (e.g. "grch38/star/{star_version}/gencode{gencode_version}-{read_length}")
	PL             map[string][]string // placeholder values (all values for templates; single-element for expanded)
	PLOrder        []string            // placeholder key declaration order
}

PackageInfo holds information about a build script

type RemoteHelperMetadataCache added in v1.3.0

type RemoteHelperMetadataCache struct {
	FetchedAt time.Time                            `json:"fetched_at"`
	SourceURL string                               `json:"source_url"`
	Metadata  map[string]map[string]rawHelperEntry `json:"metadata"`
}

RemoteHelperMetadataCache is the on-disk envelope for cached helper script metadata.

type SearchMode added in v1.3.0

type SearchMode int

SearchMode describes how a SearchQuery matches candidate names.

const (
	SearchModeAnd     SearchMode = iota // all terms must substring-match (default)
	SearchModeExact                     // each term is an exact full-name match (OR across terms)
	SearchModePattern                   // single term compiled as regex (wildcard or literal regex)
)

type SearchQuery added in v1.3.0

type SearchQuery struct {
	Raw  []string // normalised (lowercased) terms
	Mode SearchMode
	// contains filtered or unexported fields
}

SearchQuery holds the compiled, normalised search state for one command invocation.

func NewSearchQuery added in v1.3.0

func NewSearchQuery(filters []string, exactLookup func(string) bool) *SearchQuery

NewSearchQuery builds a SearchQuery from normalised filter terms. exactLookup(term) must return true when term is a case-insensitive exact full name in the candidate set (installed overlays or available build scripts). Pass nil to skip exact-first detection.

Detection order (single term):

  1. exactLookup match → SearchModeExact
  2. regex metacharacters present → SearchModePattern (regex)
  3. '*' or '?' present → SearchModePattern (wildcard anchored)
  4. plain string → SearchModeAnd (substring)

Multiple terms: exact-first detection only (no pattern matching).

func (*SearchQuery) HighlightRegexp added in v1.3.0

func (q *SearchQuery) HighlightRegexp() *regexp.Regexp

HighlightRegexp returns a compiled regex suitable for single-pass term highlighting. Returns nil when there are no terms. In pattern mode the match regex itself is reused. In and/exact modes every raw term is highlighted literally.

func (*SearchQuery) Matches added in v1.3.0

func (q *SearchQuery) Matches(name string) bool

Matches reports whether name satisfies the query.

func (*SearchQuery) MatchesOrAlias added in v1.3.0

func (q *SearchQuery) MatchesOrAlias(name, alias string) bool

MatchesOrAlias is like Matches but, in exact mode only, also accepts alias as an alternative name (e.g. "rstudio-server" for "ubuntu24/rstudio-server"). Pass an empty alias to skip the alias check.

Jump to

Keyboard shortcuts

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