cli

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 60 Imported by: 0

Documentation

Overview

Package cli registers selfdoc's whole command tree on one strictcli application.

One binary carries what used to be two Python CLIs, so every cross-CLI refusal they made is gone: `build --target unified` builds a unified site here rather than naming another package, and `check` answers for every project kind. What each command does, refuses and prints is otherwise the Python's, verbatim.

Nothing here changes the process's working directory. The directory a command operates on is Options.Dir, which the editor's publish path sets explicitly so an in-process invocation can act on a repository that is not the one the editor was started in.

Index

Constants

View Source
const AppHelp = "Code-aware static site generator with directive-based content extraction"

AppHelp is the one-line description `selfdoc --help` prints.

Variables

This section is empty.

Functions

func New

func New(opts Options) *strictcli.App

New builds the selfdoc application.

Installing the lint-code validator is part of building the binary rather than optional: internal/config keeps the check as a seam so it stays loadable without the lint registry, and while the seam is nil a config's lint_ignore list is accepted as written.

Types

type Options

type Options struct {
	// Dir is the project directory every command operates on. Empty means
	// the process's own working directory, spelled ".".
	Dir string
	// Stdout and Stderr are where a command's human output goes. Nil means
	// the process's own streams, read at write time so strictcli's Test can
	// capture them.
	Stdout io.Writer
	Stderr io.Writer
	// Registry is how a toolchain pin is checked for publication. The zero
	// value reads the real registries.
	Registry assembly.Registry
	// Version is the binary's own release version: what `selfdoc --version`
	// prints, and the selfdoc pin a generated deploy workflow installs when
	// no version is named explicitly. The binary reads it from the
	// repository's VERSION file, embedded at compile time, and hands it in
	// here -- nothing under internal/ reads that file. Empty states no
	// version, and the paths that need a real one refuse rather than
	// inventing one.
	Version string
}

Options is everything one application is built from.

Only Version comes from the binary itself; every other member has a working zero value. Those members exist for the two callers that are not the binary: the editor's publish path, which runs a command in-process against a stated directory and collects its output, and the suite, which stubs the two registries a toolchain pin is checked against.

Directories

Path Synopsis
Package faketool is the fake external tool the cli suite puts at the front of PATH under whatever names a test asks for -- "gh", "npx", and so on.
Package faketool is the fake external tool the cli suite puts at the front of PATH under whatever names a test asks for -- "gh", "npx", and so on.
Command faketoolcmd is the executable the cli suite installs at the front of PATH under each external tool's name.
Command faketoolcmd is the executable the cli suite installs at the front of PATH under each external tool's name.

Jump to

Keyboard shortcuts

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