cmdutil

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cmdutil provides shared CLI helpers for epack commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterConfigCollectors

func FilterConfigCollectors(cfg *config.JobConfig, names []string) (*config.JobConfig, error)

FilterConfigCollectors returns a copy of cfg with only the specified collectors. Returns an error if any collector is not found.

func FilterConfigComponents

func FilterConfigComponents(cfg *config.JobConfig, names []string) (*config.JobConfig, error)

FilterConfigComponents returns a copy of cfg with only the specified components. Components can be collectors, tools, or remotes - the function figures out which. Returns an error if any component is not found.

func GetOutput

func GetOutput(cmd *cobra.Command) *output.Writer

GetOutput returns an output writer configured from the command's flags.

func HandleError

func HandleError(err error) error

HandleError ensures errors have proper exit codes. If the error already has ExitCode(), it's returned as-is. Otherwise wraps it in an errors.Error with General exit code.

func LoadConfig

func LoadConfig(path string) (*config.JobConfig, error)

LoadConfig loads the component configuration from the given path. Returns a wrapped error on failure with actionable hints.

func LockfileNeedsUpdate

func LockfileNeedsUpdate(cfg *config.JobConfig, lf *lockfile.LockFile, currentPlatform string) bool

LockfileNeedsUpdate checks if the lockfile needs updating for the given config. This checks both collectors and tools.

func ParseCommaSeparated

func ParseCommaSeparated(s string) []string

ParseCommaSeparated splits a comma-separated string into trimmed elements. Returns nil if the input is empty.

func ResolveWorkDir

func ResolveWorkDir() (string, error)

ResolveWorkDir returns the current working directory. Returns a wrapped error on failure.

func ValidateCollectorNames

func ValidateCollectorNames(cfg *config.JobConfig, names []string) error

ValidateCollectorNames checks that all names exist in config as collectors. Returns an error if any name is not found.

Types

This section is empty.

Jump to

Keyboard shortcuts

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