configcmd

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package configcmd implements the `vigolium config` command group.

It is the first command group split out of the flat pkg/cli package into its own subpackage. Rather than self-registering via init() into a package-private rootCmd, it exposes an explicit NewCommand(deps, examples) constructor that pkg/cli wires onto the root command. All of the implicit package-global state the commands previously reached for (the --config / --force flag values and the first-run reinitializer) is passed in explicitly via Deps, so this package has no dependency back on pkg/cli.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand(deps Deps, ex Examples) *cobra.Command

NewCommand builds the `config` command group with its subcommands.

Types

type Deps

type Deps struct {
	// ConfigFlag returns the raw --config flag value (may be empty).
	ConfigFlag func() string
	// Force returns the --force flag value.
	Force func() bool
	// Reinitialize regenerates ~/.vigolium with fresh defaults (used by `config clean`).
	Reinitialize func() error

	// JSON reports whether the caller asked for machine output. The config
	// commands accepted the persistent --json flag and ignored it, printing
	// ANSI-colored prose to stdout and exiting 0 — so a consumer's parse failed
	// for a reason the exit code did not describe.
	JSON func() bool
	// WriteJSON emits a result through the CLI's shared envelope writer, so a
	// config result has the same schema_version/items/generated_at spine as every
	// other -j payload rather than a second shape invented here. total is the row
	// count, which the caller already knows — passing it avoids reflecting over
	// the slice on the other side of the seam.
	WriteJSON func(command, legacyKey string, items any, total int, extra map[string]any) error
}

Deps carries the runtime dependencies the config commands need, injected by pkg/cli so this package stays decoupled from the CLI's global flag state.

type Examples

type Examples struct {
	Parent string
	Ls     string
	Set    string
	Clean  string
}

Examples carries the per-command example blocks, defined in pkg/cli.

Jump to

Keyboard shortcuts

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