cli

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package cli is the outermost layer: it parses arguments, calls the domain and storage packages, and owns every line printed to the terminal.

The layers below never print and never call os.Exit. That is why App takes its working directory and its two writers as fields — a test can run a whole command against a temporary directory and read back exactly what a user would have seen.

Index

Constants

This section is empty.

Variables

View Source
var Version = "0.5.0"

Version is stamped at build time with -ldflags "-X github.com/SergeyLubivui-dev/devtree/internal/cli.Version=v1.2.3".

The default is what a plain `go build` reports, so it tracks the last release rather than sitting at whatever the first one happened to be.

Functions

func Run

func Run(args []string, stdout, stderr io.Writer) int

Run wires App to the real process and returns the exit code, leaving the os.Exit call to main so nothing below it can end the program mid-flight.

Types

type App

type App struct {
	Dir string    // working directory the command was invoked from
	Out io.Writer // normal output
	Err io.Writer // errors and warnings
}

App holds everything a command needs from the outside world.

func (*App) Execute

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

Execute dispatches one command and returns a process exit code:

0  success
1  the command failed
2  the command line itself was wrong

Jump to

Keyboard shortcuts

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