internal

package
v0.0.0-...-d5053ca Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package internal provides shared utilities for the e3cnc-tui Go binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPaths

func DefaultPaths() map[string]string

DefaultPaths returns standard E3CNC paths relative to the user's home.

func InstallJournalPath

func InstallJournalPath() string

InstallJournalPath returns the path to the install journal.

func SaveState

func SaveState(s State) error

SaveState writes the persistent state to disk.

func WriteInstallJournal

func WriteInstallJournal(j InstallJournal) error

WriteInstallJournal writes an install journal entry to disk.

Types

type CommandDef

type CommandDef struct {
	Name        string    `json:"name"`
	Aliases     []string  `json:"aliases"`
	Destructive bool      `json:"destructive"`
	Blocking    bool      `json:"blocking"`
	Interactive bool      `json:"interactive"`
	Flags       []FlagDef `json:"flags"`
}

CommandDef represents a single command definition from commands.json.

type CommandsManifest

type CommandsManifest struct {
	Version  string       `json:"version"`
	Commands []CommandDef `json:"commands"`
}

CommandsManifest is the root structure of commands.json.

func LoadCommands

func LoadCommands() (*CommandsManifest, error)

LoadCommands reads and parses commands.json. It searches the repo checkout path relative to the binary location.

func (*CommandsManifest) AllCommandNames

func (m *CommandsManifest) AllCommandNames() []string

AllCommandNames returns all command names and aliases.

func (*CommandsManifest) FindCommand

func (m *CommandsManifest) FindCommand(name string) *CommandDef

FindCommand looks up a command by name or alias. Returns nil if not found.

func (*CommandsManifest) IsKnownCommand

func (m *CommandsManifest) IsKnownCommand(name string) bool

IsKnownCommand checks if a string is a known command name or alias.

type FlagDef

type FlagDef struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	Short      string `json:"short,omitempty"`
	Help       string `json:"help"`
	Default    any    `json:"default,omitempty"`
	Positional bool   `json:"positional,omitempty"`
}

FlagDef represents a single flag for a command.

type InstallJournal

type InstallJournal struct {
	InstallID    string    `json:"install_id"`
	InstanceName string    `json:"instance_name"`
	StartedAt    time.Time `json:"started_at"`
	CompletedAt  time.Time `json:"completed_at,omitempty"`
	LastStep     int       `json:"last_step"`
	TotalSteps   int       `json:"total_steps"`
	Status       string    `json:"status"` // "running", "completed", "failed"
	Error        string    `json:"error,omitempty"`
	RolledBack   bool      `json:"rolled_back,omitempty"`
}

InstallJournal tracks an install attempt with step-by-step status.

func ReadInstallJournal

func ReadInstallJournal() InstallJournal

ReadInstallJournal reads the install journal from disk. Returns an empty journal if none exists.

type State

type State struct {
	ActiveInstance string `json:"active_instance,omitempty"`
	Theme          string `json:"theme,omitempty"`
	LastInstallID  string `json:"last_install_id,omitempty"`
}

State represents the persistent state for e3cnc-tui.

func LoadState

func LoadState() State

LoadState reads the persistent state from disk.

Directories

Path Synopsis
Package bootstrap handles fresh-install system provisioning.
Package bootstrap handles fresh-install system provisioning.
Package commands provides Go-native implementations of all E3CNC CLI commands.
Package commands provides Go-native implementations of all E3CNC CLI commands.
Package deploy provides release management, health checks, and backup/restore.
Package deploy provides release management, health checks, and backup/restore.
Package domain defines shared types and interfaces for the E3CNC CLI domain layer.
Package domain defines shared types and interfaces for the E3CNC CLI domain layer.
Package instance provides the E3CNC instance model and filesystem helpers.
Package instance provides the E3CNC instance model and filesystem helpers.
Package rootrun provides a single, shared, non-interactive boundary for executing commands as root (used by install, runtime service management, and health checks).
Package rootrun provides a single, shared, non-interactive boundary for executing commands as root (used by install, runtime service management, and health checks).

Jump to

Keyboard shortcuts

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