cli

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 71 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cli is the kno binary, built on fang over cobra.

The bar: a developer should never wonder what just happened, what it cost, or what to do next. Every command answers all three. Cost is always visible and confirmed before it is spent, every command ends by naming the next one, interruption is boring (checkpoint, then --resume), and errors name the exact fix.

Index

Constants

View Source
const StatusSchemaVersion = 1

StatusSchemaVersion is the shape of docs/status.json, for a consumer that must refuse a shape it does not understand.

It bumps ONLY on a breaking change: a key renamed, removed or retyped, or a value's meaning changed. Adding a key does not bump it, and a consumer that breaks on an unknown key is broken. The PR that bumps it owes two things in the same PR: a CHANGELOG entry under Unreleased, and an issue on uknoAI/kno-www naming the changed keys. CONTRIBUTING.md carries the protocol.

Variables

This section is empty.

Functions

func Execute

func Execute(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) int

Execute runs the CLI and returns the process exit code.

It returns the code rather than calling os.Exit so that main stays a one-liner and every path here is testable — an Execute that exited could only be tested by spawning a subprocess. stdin is the consent prompt's and the wizard's input: a terminal in an interactive run, whatever the caller provides otherwise.

func NewRootCmd

func NewRootCmd() *cobra.Command

NewRootCmd builds the kno command tree.

func WriteStatus added in v0.1.3

func WriteStatus(out io.Writer, debt StatusDebt) error

WriteStatus renders docs/status.json to out.

It contacts no network, resolves no credential and reads no file: every field but the ledger counts is compiled in, and those arrive as an argument. That posture is `kno doctor`'s, and it is what lets the generator run in a tree with HOME and every provider variable unset.

Types

type StatusDebt added in v0.1.3

type StatusDebt struct {
	// Total is how many ledger entries exist.
	Total int
	// Open is how many carry no disposition --- not repaid, not re-dated, not
	// promoted to won't fix.
	Open int
	// Skipped is how many lines look like ledger rows and do not parse. The
	// generator refuses to write a count over a nonzero Skipped, because a
	// skipped row is an undercount presented as a fact.
	Skipped int
}

StatusDebt is the Debt Ledger's size, as scripts/ledger-check.py reports it.

Passed in rather than read here, because docs/debt.md must have exactly one parser and it is that script. A Go reader of the same 84-row hand-written table would drift from the Python one the first time a row was formatted unusually, and it would drift silently: the two consumers ask different questions and would disagree without either failing.

Jump to

Keyboard shortcuts

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