cliconfig

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package cliconfig loads the configuration for CLI commands with an explicit policy, so every command treats a missing or invalid file the same way.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Pipeline is for commands that run tests: a silent fallback to defaults
	// would report success without testing anything.
	Pipeline = Policy{Required: true, Validate: true, CheckPaths: true}
	// Compat is for the --stable flow, whose configs follow the fixed
	// contract and need not satisfy the gtool validator.
	Compat = Policy{Required: true}
	// Start is for commands that start containers from an optional config.
	Start = Policy{Validate: true}
	// Inspect is for read-only and teardown commands, which must work even
	// with a config that would not validate.
	Inspect = Policy{}
)

Functions

func Load

func Load(path string, p Policy, notice io.Writer) (*config.Config, error)

Load reads the config at path, or from the default locations when path is empty, applying p. When an optional config is absent it returns the built-in defaults and writes a notice to notice (if not nil).

Types

type Policy

type Policy struct {
	// Required fails when no file is given or found in the default locations.
	Required bool
	// Validate runs the validator on a loaded file (never on built-in defaults).
	Validate bool
	// CheckPaths makes the validator require configured paths to exist.
	CheckPaths bool
}

Policy states whether a command needs a config file and how strictly it is checked before anything starts.

Jump to

Keyboard shortcuts

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