root

package
v0.0.0-...-443b9db Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package root builds the linuxctl Cobra command tree.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(info BuildInfo) error

Execute runs the linuxctl CLI.

func MigrateRegistry

func MigrateRegistry() error

MigrateRegistry auto-migrates ~/.linuxctl/envs.yaml → ~/.linuxctl/stacks.yaml on startup if:

  • envs.yaml exists, AND
  • stacks.yaml does NOT exist

In that case envs.yaml is renamed to stacks.yaml (preserving contents bit-for-bit) and a one-time warning is printed to stderr. If both exist, stacks.yaml wins, envs.yaml is left alone, and a warning is emitted on every startup until the user removes envs.yaml. Returns nil if no migration is needed.

This is called from NewRootCmd so every invocation has the registry in its canonical location. Fixes #17 with a one-release deprecation window.

func NewRootCmd

func NewRootCmd(info BuildInfo) *cobra.Command

NewRootCmd builds the root Cobra command with all subtrees registered.

func RegistryPathForRead

func RegistryPathForRead() (string, error)

RegistryPathForRead returns the path the stack registry should be loaded from. Callers should normally invoke MigrateRegistry() first; this helper additionally falls back to legacyRegistryPath() if stacks.yaml is absent but envs.yaml exists (defense-in-depth for the deprecation window).

Types

type BuildInfo

type BuildInfo struct {
	Version string
	Commit  string
	Date    string
}

BuildInfo is injected from main.

Jump to

Keyboard shortcuts

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