cli

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitOK         = 0 // success
	ExitError      = 1 // generic/unexpected failure
	ExitUsage      = 2 // invalid flags or arguments
	ExitConfig     = 3 // configuration or authentication problem
	ExitNotFound   = 4 // requested resource does not exist
	ExitConflict   = 5 // resource conflict (e.g. already exists)
	ExitValidation = 6 // request rejected by server validation
	ExitNetwork    = 7 // network failure / transient server error after retries
)

Exit codes form part of the agent contract. They are stable and documented in the README so scripts can branch on failure class without parsing text.

Variables

This section is empty.

Functions

func Main

func Main() int

Main is the program entry point. It returns the process exit code. It wires the real process streams and the signal-derived context, then defers all contract behaviour to run; keeping Main this thin means the subprocess smoke test (which execs the real binary) covers every branch it adds over run.

func NewRootCommand

func NewRootCommand(f *Factory) *cobra.Command

NewRootCommand builds the root command and wires every subcommand to the supplied factory.

Types

type Factory

type Factory struct {
	In  io.Reader
	Out io.Writer
	Err io.Writer
	// contains filtered or unexported fields
}

Factory builds the per-invocation dependencies (config, client, printer) from the global flags and environment. It is the single seam the commands depend on, which keeps them thin and testable.

func (*Factory) Client

func (f *Factory) Client(_ context.Context) (*core.Client, error)

Client builds an authenticated Mealie client, failing with a clear config error if the server URL or token is missing.

func (*Factory) Printer

func (f *Factory) Printer() (*output.Printer, error)

Printer constructs the output sink from the resolved format and TTY state.

Jump to

Keyboard shortcuts

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