BUILT_INconstno test imports itconst BUILT_IN: readonly ["help", "explain", "completions", "man", "run"]The words the surface itself answers, beside the program's commands.
The documents generated from a program's tree (commons headless 0004-headless-cli FR-010): its help at every level, its completions for bash, zsh, fish and PowerShell, and its man page. They are made from the declaration alone, so a command added to the tree is in all of them with nothing else written, and none can say what the parser does not accept. A verb's help includes the options its effect gives it (--dry-run, --yes) and what its action is: what it may change, whether it is safe to repeat, who it is for.
import { completions } from "./help.ts";
import { programOf, branch } from "@intellectual-frontiers/headless/logical";
completions(programOf({ name: "tool", summary: "A tool.", version: "1", children: [branch({ name: "repo", summary: "Repos.", children: [] })] }), "bash").includes("repo"); // trueBUILT_INconstno test imports itconst BUILT_IN: readonly ["help", "explain", "completions", "man", "run"]The words the surface itself answers, beside the program's commands.
SHELLSconstconst SHELLS: readonly ["bash", "zsh", "fish", "powershell"]The shells there are completions for.
Shelltypeno test imports ittype Shell = (typeof SHELLS)[number];A shell there are completions for.
isShellfunctionfunction isShell(word: string): word is "bash" | "fish" | "powershell" | "zsh"Whether a word names a shell there are completions for.
effectLinesfunctionfunction effectLines(f: ActionFacts): readonly string[]What an action is, in lines for its help.
helpForfunctionfunction helpFor(program: Program, path: readonly string[]): string | undefinedThe help of the node named by path (the words below the program), or undefined where there is none.
Completiontypeno test imports ittype Completion = { readonly path: readonly string[]; readonly words: readonly string[] };What a shell completes after a path of words: the words of that place.
completionTablefunctionfunction completionTable(program: Program): readonly Completion[]Every place a shell completes: each branch with its commands, each command with its options. The program's own place is first and holds the built-in words.
completionsfunctionfunction completions(program: Program, shell: "bash" | "fish" | "powershell" | "zsh"): stringThe completion script of a program for a shell.
manPagefunctionfunction manPage(program: Program): stringThe man page of a program, in roff: its commands with their options and effects, and its exit statuses from the one table. It holds no date, so the same program gives the same bytes.