cli

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cli is a stdlib flag-based runner for chalk-based, task-oriented CLIs. It wires Reporter construction, the standard -I/-O/-o/-extension I/O flags, and a checkpoint cache (-cache) on top of github.com/fogfish/stream/spool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Commit

func Commit[T any](key string, val T) error

Commit persists val under key in the -cache directory. It is a no-op if -cache was not set. Init must have been called first.

func Init

func Init() *chalk.Reporter

Init parses flags, builds a Reporter via chalk.New and installs it as chalk.Default(). It also wires the -cache checkpoint cache as checkpoint.Default(), used by Recover/Commit. Call this directly if you only need the reporter (e.g. you're not using Start).

func Recover

func Recover[T any](key string, def T) T

Recover loads a previously Commit-ed value for key from the -cache directory, or returns def if no cache is configured or the value is missing/unreadable. Init must have been called first.

func Start

func Start(f spool.Spooler)

Start parses flags, wires source/target via spool, runs f over every input, and calls Reporter.Quit().

Types

This section is empty.

Jump to

Keyboard shortcuts

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