cli

package
v0.0.1-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package cli implements lumos' command-line interface: argument parsing, the interactive theme/variant picker, and the install/update/enable flows.

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Version is overridden at build time via -ldflags. When unset (e.g. a plain `go install`), Version() falls back to the module version from the build info, so `go install ...@v0.0.1-alpha.1` still reports the right version.

Functions

func ParseSelection

func ParseSelection(input string, n int) (int, error)

ParseSelection validates a 1-based menu choice against n options and returns a 0-based index. An empty string means "cancel" and is an error.

func RenderThemeList

func RenderThemeList(themes []theme.Theme, current string) string

RenderThemeList formats the picker list, marking the current theme.

func RenderVariantList

func RenderVariantList(th theme.Theme, current string) string

RenderVariantList formats a theme's variants, marking the current one.

Types

type App

type App struct {
	Paths  config.Paths
	Runner apply.Runner
	Cloner source.Cloner
	In     io.Reader
	Out    io.Writer
	Err    io.Writer
}

App carries the runtime dependencies, injectable for testing.

func New

func New() *App

New builds an App wired to the real environment.

func (*App) Run

func (a *App) Run(args []string) int

Run parses args and dispatches. It returns a process exit code.

type Mode

type Mode int

Mode is the high-level action selected by the arguments.

const (
	ModeInteractive Mode = iota
	ModeList
	ModeInstall
	ModeUpdate
	ModeEnable
	ModeHelp
	ModeVersion
)

The available modes.

type Options

type Options struct {
	Mode    Mode
	Spec    string // --install argument
	Name    string // theme slug for enable/update
	Variant string // variant id for enable
	Enable  bool   // --enable
	DryRun  bool   // --dry-run
}

Options is the parsed command line.

func ParseArgs

func ParseArgs(args []string) (Options, error)

ParseArgs turns raw arguments into Options.

Jump to

Keyboard shortcuts

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