cmd

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: BSD-3-Clause Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Generic error code
	ExitCodeError = 1
	// Returned when jobs were submitted to a scheduler (overlays will be created asynchronously)
	ExitCodeJobsSubmitted = config.ExitCodeJobsSubmitted
)

Exit codes used by various commands

Variables

This section is empty.

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 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 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

func ResolveFlagAlias added in v1.5.1

func ResolveFlagAlias(cmd *cobra.Command, canonical, alias string)

ResolveFlagAlias copies the value of an alias flag onto its canonical flag when the user set the alias but not the canonical name. Both flags must be registered against separate variables so that an explicit `--alias=false` is honoured; when both are given, the canonical flag wins. Call it before reading the bound value.

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

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 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 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) 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.

func (*SearchQuery) MatchesOrAliasWithText added in v1.5.1

func (q *SearchQuery) MatchesOrAliasWithText(name, alias, text string) bool

MatchesOrAliasWithText is MatchesOrAlias extended to a secondary field such as a description. Pass an empty text to skip it.

In AND mode each term may be satisfied by either field, so "cellranger index" matches an entry named for the tool and described as an index. Other modes test each field on its own rather than a concatenation, which would break anchored patterns like "*server".

Directories

Path Synopsis
internal
clilog
Package clilog provides a slog.Handler that routes structured log records through the CLI's utils.Print* functions, so any internal package using logging.FromContext(ctx) produces the familiar [CNT][TAG] terminal output.
Package clilog provides a slog.Handler that routes structured log records through the CLI's utils.Print* functions, so any internal package using logging.FromContext(ctx) produces the familiar [CNT][TAG] terminal output.
ui

Jump to

Keyboard shortcuts

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