~/bend-docscommunity

cli.bend checks

raw source on the hub · import cli@0.1.0.0/cli.bend as Cli

Purpose: pure command definitions, validation, and text rendering for Bend CLIs. Expected output: ALL PROOFS CHECK. Run: bend cli.bend --check-only

1 import
import Base

Types

type Style source · line 7 · raw

Data

type Segment source · line 18 · raw

Data

type StripState source · line 71 · raw

Data

type CodeRange source · line 114 · raw

Data

type CodeClass source · line 869 · raw

Data

What a code point can do in an emoji sequence (UTS #51): start a keycap (#, * and 0-9), be a pictograph, a skin tone, a ZWJ or VS16, or none.

type EmojiRun source · line 881 · raw

Data

Where width stands in an emoji sequence: outside one; after an emoji, with the code a skin tone or VS16 applies to, whether it counts 1 so far, and whether a ZWJ may join it; after such a ZWJ; or after a pictograph that a ZWJ joined, which adds nothing.

type WidthStep source · line 887 · raw

Data

type WrapState source · line 1015 · raw

Data

type ValueType source · line 1054 · raw

Data

type Item source · line 1071 · raw

Data

type Cmd source · line 1100 · raw

Data

type Problem source · line 1103 · raw

Data

type UsageKind source · line 1225 · raw

Data

type Usage source · line 1233 · raw

Data

type NameScan source · line 1237 · raw

Data

type PhScan source · line 1242 · raw

Data

PhOK's name is reversed: only a positional's name is read.

type LintItem source · line 1703 · raw

Data

An item as lint walks it: an Arg with its usage parsed once, a Sub with its children's too.

type Seen source · line 1769 · raw

Data

type DecimalState source · line 1941 · raw

Data

type Bad source · line 2014 · raw

Data

The first element of a value that fails to convert, and why.

type Src source · line 2359 · raw

Data

type Var source · line 2365 · raw

Data

type Host source · line 2368 · raw

Data

type Field source · line 2371 · raw

Data

type ScanEvent source · line 2374 · raw

Data

type ScanFault source · line 2383 · raw

Data

type ExternalArgs source · line 2396 · raw

Data

type ScanTrace source · line 2399 · raw

Data

type ParseResult source · line 2404 · raw

Data

type Early source · line 2412 · raw

Data

type Gather source · line 2418 · raw

Data

An arg's hits so far: values holds a repeated option's newest first, so each hit conses, and resolve_argv_gather puts them back in argv order.

type FieldBuild source · line 2421 · raw

Data

type EnvValue source · line 2425 · raw

Data

type ArgInfo source · line 2448 · raw

Data

type OptFound source · line 2452 · raw

Data

type SubFound source · line 2455 · raw

Data

type SubKey source · line 2459 · raw

Data

A subcommand a scope answers to, by name or alias.

type OptKey source · line 2463 · raw

Data

An option name a scope answers to, with the match it makes.

type SpecItem source · line 2467 · raw

Data

An item resolve walks: an Arg with its usage parsed once, or another item.

type Spec source · line 2474 · raw

Data

A scope with each usage parsed once: its option names (own, then global), the items resolve walks (global, then own), its positionals and subcommands, and the globals its subcommands inherit.

type Scope source · line 2480 · raw

Data

type ScanState source · line 2483 · raw

Data

type Tail source · line 2489 · raw

Data

Phases after which no token is an operand and -- is plain.

type Mode source · line 2494 · raw

Data

type TokenClass source · line 3431 · raw

Data

How an open scan reads a token: a long option, a dash token (a cluster of short options, or an operand a slot takes), or a word; "-" is a word.

type Fault source · line 4149 · raw

Data

type Matches source · line 4164 · raw

Data

type Form source · line 4211 · raw

Data

type Want source · line 4217 · raw

Data

What a reader asks of an arg; Q-static checks it against the spec.

type KeyStep source · line 4613 · raw

Data

How a route key's next word meets an item: not its subcommand, the subcommand of a built-in, the command the key ends at, or a command whose subcommands take the rest (§6.4).

type Term source · line 4790 · raw

Data

type Prescan source · line 4819 · raw

Data

The pre-scan of argv: the last --color value before --, "" for a bare --color before a hyphen token.

type View source · line 4961 · raw

Data

The command at the longest valid prefix of a path, with the globals it inherits, root first; stuck once a step names no subcommand.

type Row source · line 5117 · raw

Data

A help row: its left cell, whether it is an option with a short or a long-only option, and its right text.

type Section source · line 5120 · raw

Data

type Scored source · line 5474 · raw

Data

type Shell source · line 5932 · raw

Data

type Place source · line 6024 · raw

Data

A command on a visible path, in pre-order from the root: the words of its path below the root, its items, and the globals it inherits, root first.

type Comp source · line 6047 · raw

Data

What a value completes to: a word of the one_of list numbered list, a file, a directory, or nothing.

type Opt source · line 6055 · raw

Data

An option as a script offers it: its names, shorts first, its kind, its placeholder, what its value completes to, and its help on one line.

type Slot source · line 6060 · raw

Data

A positional slot, numbered from 1.

type Entry source · line 6065 · raw

Data

A visible subcommand: its name, its names with aliases, and its summary.

type Stop source · line 6254 · raw

Data

What a script needs at a place: its number, its words, its options in scope, own first, the built-ins, its visible subcommands, and its slots.

type Outcome source · line 7426 · raw

Data

type Linted source · line 7500 · raw

Data

A Cmd that passed lint, from linted: eval_linted skips the lint eval runs.

type Step source · line 7520 · raw

@-A:Type -> Type

Definitions

def style_code source · line 21 · raw

@style:Style -> String

def style_codes_tail source · line 33 · raw

@styles:List<&2, Style> -> String

def style_codes source · line 39 · raw

@styles:List<&2, Style> -> String

def paint source · line 45 · raw

@on:Bool -> @styles:List<&2, Style> -> @text:String -> String

def emit_go source · line 56 · raw

@segments:List<&2, Segment> -> @+on:Bool -> String

def emit source · line 65 · raw

@on:Bool -> @segments:List<&2, Segment> -> String

def sgr_body_char source · line 68 · raw

@+c:Char -> Bool

def strip_go source · line 76 · raw

@s:String -> @state:StripState -> String

def strip source · line 111 · raw

@s:String -> String

def contains_range source · line 117 · raw

@ranges:List<&2, CodeRange> -> @+code:U32 -> Bool

def unicode_is_wide source · line 127 · raw

@code:U32 -> Bool

Unicode 15.1 East Asian Wide and Fullwidth ranges, including reserved ranges. Source: https://www.unicode.org/Public/15.1.0/ucd/EastAsianWidth.txt

def unicode_is_zero_mark source · line 253 · raw

@code:U32 -> Bool

Unicode 15.1 nonspacing and enclosing mark ranges (Mn and Me). Source: https://www.unicode.org/Public/15.1.0/ucd/UnicodeData.txt

def unicode_is_pictographic source · line 602 · raw

@code:U32 -> Bool

Unicode 15.1 Extended_Pictographic ranges, including reserved ranges. Source: https://www.unicode.org/Public/15.1.0/ucd/emoji/emoji-data.txt

def unicode_takes_tone source · line 686 · raw

@code:U32 -> Bool

Unicode 15.1 Emoji_Modifier_Base ranges: the emoji a skin tone modifies. Source: https://www.unicode.org/Public/15.1.0/ucd/emoji/emoji-data.txt

def unicode_widens_with_vs16 source · line 734 · raw

@code:U32 -> Bool

Unicode 15.1 code points with an emoji presentation sequence (VS16) that are not East Asian Wide or Fullwidth, so VS16 widens them to 2. Sources: https://www.unicode.org/Public/15.1.0/ucd/emoji/emoji-variation-sequences.txt and https://www.unicode.org/Public/15.1.0/ucd/EastAsianWidth.txt

def code_width_by source · line 853 · raw

@small:Bool -> @+code:U32 -> Nat

A code point's own width: controls, marks, 200B-200F and tag characters (E0000-E007F) are 0, East Asian Wide and Fullwidth are 2, the rest 1.

def code_width source · line 864 · raw

@+code:U32 -> Nat

def keycap_base source · line 890 · raw

@+code:U32 -> Bool

def picto_class source · line 896 · raw

@may:Bool -> @+code:U32 -> CodeClass

may: whether code is in 203C-3299 or from 1F000, which hold every pictograph from 768 on.

def code_class_by source · line 903 · raw

@small:Bool -> @+code:U32 -> CodeClass

def code_class source · line 917 · raw

@+code:U32 -> CodeClass

def picto_alone source · line 920 · raw

@+wide:Bool -> @code:U32 -> WidthStep

def picto_step source · line 925 · raw

@run:EmojiRun -> @+code:U32 -> WidthStep

A pictograph after a ZWJ joins the sequence; any other starts an emoji.

def tone_on source · line 935 · raw

@takes:Bool -> @narrow:Bool -> @join:Bool -> @code:U32 -> WidthStep

A skin tone after an emoji that takes one widens it to 2; any other is 2 wide alone, as East Asian Wide.

def tone_on_joined source · line 942 · raw

@takes:Bool -> @code:U32 -> WidthStep

def tone_step source · line 947 · raw

@run:EmojiRun -> @code:U32 -> WidthStep

def joiner_run source · line 957 · raw

@run:EmojiRun -> EmojiRun

A ZWJ after an emoji that may join, or after a joined pictograph, waits for the next pictograph.

def vs16_widen source · line 965 · raw

@widens:Bool -> @code:U32 -> @join:Bool -> WidthStep

def vs16_on source · line 970 · raw

@narrow:Bool -> @+code:U32 -> @join:Bool -> WidthStep

def vs16_step source · line 976 · raw

@run:EmojiRun -> WidthStep

VS16 widens a 1-wide emoji with an emoji presentation to 2, once.

def code_step source · line 983 · raw

@cls:CodeClass -> @run:EmojiRun -> @code:U32 -> WidthStep

def width_go source · line 993 · raw

@s:String -> @step:WidthStep -> @acc:Nat -> Nat

acc, plus the width of step, the last code point's, and of s after it.

def width source · line 1004 · raw

@s:String -> Nat

Display columns, as Rust's unicode-width 0.2 counts them: each code point's own width, except that an emoji sequence is one cell 2 wide. A pictograph that a ZWJ joins, a skin tone after an emoji that takes one, and tag characters add nothing; VS16 widens a 1-wide emoji to 2.

def leading_indent source · line 1007 · raw

@s:String -> String

def wrap_words source · line 1019 · raw

@words:List<&2, String> -> @state:WrapState -> String

def words source · line 1034 · raw

@s:String -> List<&2, String>

def wrap_line source · line 1038 · raw

@+line:String -> @cols:Nat -> String

def wrap_lines source · line 1044 · raw

@lines:List<&2, String> -> @+cols:Nat -> List<&2, String>

def wrap source · line 1051 · raw

@text:String -> @cols:Nat -> String

def type_name source · line 1062 · raw

@t:ValueType -> String

def cmd source · line 1119 · raw

@name:String -> @about:String -> @items:List<&2, Item> -> Cmd

def sub source · line 1122 · raw

@name:String -> @about:String -> @items:List<&2, Item> -> Item

def arg source · line 1125 · raw

@usage:String -> @help:String -> @items:List<&2, Item> -> Item

def version source · line 1128 · raw

@value:String -> Item

def alias source · line 1131 · raw

@name:String -> Item

def hidden source · line 1134 · raw

Item

def example source · line 1137 · raw

@line:String -> @what:String -> Item

def after source · line 1140 · raw

@text:String -> Item

def sub_optional source · line 1143 · raw

Item

def external source · line 1146 · raw

Item

def exclusive source · line 1149 · raw

@group:String -> Item

def need_one source · line 1152 · raw

@group:String -> Item

def id source · line 1155 · raw

@value:String -> Item

def required source · line 1158 · raw

Item

def default source · line 1161 · raw

@value:String -> Item

def env source · line 1164 · raw

@name:String -> Item

def global source · line 1167 · raw

Item

def heading source · line 1170 · raw

@title:String -> Item

def as_nat source · line 1173 · raw

Item

def as_u32 source · line 1176 · raw

Item

def as_f32 source · line 1179 · raw

Item

def as_bool source · line 1182 · raw

Item

def as_file source · line 1185 · raw

Item

def as_dir source · line 1188 · raw

Item

def one_of source · line 1191 · raw

@values:List<&2, String> -> Item

def delim source · line 1194 · raw

@sep:Char -> Item

def hyphen source · line 1197 · raw

Item

def rest source · line 1200 · raw

Item

def bare source · line 1203 · raw

@value:String -> Item

def conflicts source · line 1206 · raw

@target:String -> Item

def requires source · line 1209 · raw

@target:String -> Item

def group source · line 1212 · raw

@name:String -> Item

def color source · line 1215 · raw

Item

def completions source · line 1219 · raw

Item

Builtin{} marks the subcommands that only eval acts on (§6.4).

def man source · line 1222 · raw

Item

def name_start source · line 1246 · raw

@+c:Char -> Bool

def name_char source · line 1249 · raw

@+c:Char -> Bool

def finish_name source · line 1254 · raw

@rev:String -> @rest:String -> @+pos:Nat -> @+first:Bool -> @+dot_start:Nat -> NameScan

rev is the name so far, reversed.

def scan_name source · line 1260 · raw

@s:String -> @+pos:Nat -> @rev:String -> @+first:Bool -> @dot_start:Nat -> NameScan

def ph_stop source · line 1278 · raw

@at_close:Bool -> @rev:String -> @rest:String -> @+pos:Nat -> PhScan

A placeholder ends at a character no name holds: at close after a name, else with an error there.

def scan_ph source · line 1285 · raw

@s:String -> @+pos:Nat -> @rev:String -> @+close:Char -> PhScan

The placeholder name in s up to close, reversed in rev. A name holds no space, '<', '>', '[', ']' or '=', and close is one of them.

def finish_pos source · line 1296 · raw

@found:PhScan -> @kind:UsageKind -> Usage

def parse_pos source · line 1305 · raw

@s:String -> @+repeat:Bool -> Usage

def finish_required_value source · line 1316 · raw

@found:PhScan -> @id:String -> @short:String -> @long:String -> @kind:UsageKind -> Usage

def finish_optional_value source · line 1326 · raw

@found:PhScan -> @id:String -> @short:String -> @long:String -> Usage

def finish_long source · line 1336 · raw

@found:NameScan -> @short:String -> @+repeat:Bool -> @+negatable:Bool -> Usage

def parse_long_prefixed source · line 1358 · raw

@s:String -> @short:String -> @repeat:Bool -> @+start:Nat -> Usage

A long name after "--[no-]" or "--", at column start.

def parse_short_tail source · line 1371 · raw

@tail:String -> @+short:String -> @+repeat:Bool -> Usage

def parse_short source · line 1388 · raw

@s:String -> @repeat:Bool -> Usage

def parse_usage_body source · line 1397 · raw

@s:String -> @+repeat:Bool -> Usage

def ends_in_ellipsis source · line 1411 · raw

@s:String -> @run:Nat -> Bool

Whether s ends in "...": run counts the dots just before s.

def parse_usage_repeated source · line 1417 · raw

@repeated:Bool -> @+usage:String -> Usage

def parse_usage source · line 1424 · raw

@+usage:String -> Usage

def alias_valid_result source · line 1427 · raw

@parsed:Usage -> @+raw:String -> Bool

def valid_arg_alias source · line 1433 · raw

@+raw:String -> Bool

def kind_pos source · line 1436 · raw

@kind:UsageKind -> Bool

def kind_optional_pos source · line 1441 · raw

@kind:UsageKind -> Bool

def kind_variadic_pos source · line 1446 · raw

@kind:UsageKind -> Bool

def kind_required_pos source · line 1451 · raw

@kind:UsageKind -> Bool

def kind_valued source · line 1456 · raw

@kind:UsageKind -> Bool

def kind_bare source · line 1463 · raw

@kind:UsageKind -> Bool

def kind_default_allowed source · line 1468 · raw

@kind:UsageKind -> Bool

def kind_required_allowed source · line 1476 · raw

@kind:UsageKind -> Bool

def kind_delim_allowed source · line 1481 · raw

@kind:UsageKind -> Bool

def bad_attr source · line 1487 · raw

@cond:Bool -> @name:String -> Maybe<&2, String>

def misplaced_attr_name source · line 1490 · raw

@attr:Item -> @+kind:UsageKind -> Maybe<&2, String>

def maybe_misplaced source · line 1517 · raw

@found:Maybe<&2, String> -> @at:String -> List<&2, Problem>

def placement_issues source · line 1523 · raw

@attrs:List<&2, Item> -> @+kind:UsageKind -> @+at:String -> List<&2, Problem>

def value_type_names source · line 1532 · raw

@attrs:List<&2, Item> -> List<&2, String>

def extra_type_issues source · line 1538 · raw

@names:List<&2, String> -> @+at:String -> List<&2, Problem>

def duplicate_type_issues source · line 1545 · raw

@names:List<&2, String> -> @at:String -> List<&2, Problem>

def command_attr_name source · line 1551 · raw

@attr:Item -> @root:Bool -> Maybe<&2, String>

def has_rest source · line 1581 · raw

@items:List<&2, Item> -> Bool

def has_hidden source · line 1587 · raw

@items:List<&2, Item> -> Bool

def has_builtin source · line 1593 · raw

@items:List<&2, Item> -> Bool

def has_bare source · line 1599 · raw

@items:List<&2, Item> -> Bool

def has_required source · line 1605 · raw

@items:List<&2, Item> -> Bool

def duplicate_strings source · line 1611 · raw

@xs:List<&2, String> -> Bool

def bad_choices source · line 1618 · raw

@items:List<&2, Item> -> Bool

def find_default source · line 1626 · raw

@items:List<&2, Item> -> Maybe<&2, String>

def find_delim source · line 1632 · raw

@attrs:List<&2, Item> -> Maybe<&2, Char>

def split_each source · line 1638 · raw

@values:List<&2, String> -> @+sep:Char -> List<&2, String>

def apply_delim source · line 1646 · raw

@found:Maybe<&2, Char> -> @values:List<&2, String> -> List<&2, String>

def find_id source · line 1652 · raw

@items:List<&2, Item> -> Maybe<&2, String>

def find_requires source · line 1658 · raw

@items:List<&2, Item> -> List<&2, String>

def find_conflicts source · line 1664 · raw

@items:List<&2, Item> -> List<&2, String>

def find_group_attrs source · line 1670 · raw

@items:List<&2, Item> -> List<&2, String>

def find_aliases source · line 1676 · raw

@items:List<&2, Item> -> List<&2, String>

def scope_groups source · line 1682 · raw

@items:List<&2, Item> -> List<&2, String>

def scope_group_rules source · line 1689 · raw

@items:List<&2, Item> -> List<&2, String>

def lint_items source · line 1709 · raw

@items:List<&2, Item> -> List<&2, LintItem>

def has_pos_item source · line 1718 · raw

@items:List<&2, LintItem> -> Bool

def has_sub_item source · line 1725 · raw

@items:List<&2, Item> -> Bool

def has_version_item source · line 1731 · raw

@items:List<&2, Item> -> Bool

def name_scan_valid source · line 1737 · raw

@result:NameScan -> Bool

def valid_command_name source · line 1742 · raw

@s:String -> Bool

def use_id source · line 1745 · raw

@found:Maybe<&2, String> -> @derived:String -> String

def usage_id source · line 1750 · raw

@parsed:Usage -> @attrs:List<&2, Item> -> String

def scope_ids source · line 1757 · raw

@items:List<&2, LintItem> -> List<&2, String>

def same_go source · line 1777 · raw

@a:String -> @b:String -> @same:Bool -> Bool

String.eq, without rebuilding both strings to hand them back; the walk stops at the first difference.

def same_text source · line 1783 · raw

@a:String -> @b:String -> Bool

def same_nonempty source · line 1786 · raw

@+a:String -> @b:String -> Bool

def arg_collision source · line 1789 · raw

@seen:List<&2, Seen> -> @+id:String -> @+short:String -> @+long:String -> Maybe<&2, String>

def sub_collision source · line 1808 · raw

@seen:List<&2, Seen> -> @+name:String -> Bool

def arg_alias_collision source · line 1819 · raw

@seen:List<&2, Seen> -> @+name:String -> Bool

def maybe_dup source · line 1830 · raw

@found:Maybe<&2, String> -> @at:String -> List<&2, Problem>

def when_problem source · line 1835 · raw

@cond:Bool -> @problem:Problem -> List<&2, Problem>

def arg_alias_issue source · line 1838 · raw

@+name:String -> @+at:String -> @seen:List<&2, Seen> -> @version:Bool -> List<&2, Problem>

def arg_alias_issues source · line 1847 · raw

@aliases:List<&2, String> -> @+at:String -> @+seen:List<&2, Seen> -> @+version:Bool -> List<&2, Problem>

def arg_alias_entries source · line 1856 · raw

@aliases:List<&2, String> -> List<&2, Seen>

def arg_entries source · line 1862 · raw

@parsed:Usage -> @+attrs:List<&2, Item> -> List<&2, Seen>

def has_global source · line 1870 · raw

@items:List<&2, Item> -> Bool

def global_entries source · line 1876 · raw

@items:List<&2, LintItem> -> List<&2, Seen>

def sub_alias_issue source · line 1886 · raw

@+name:String -> @+at:String -> @seen:List<&2, Seen> -> List<&2, Problem>

def sub_alias_issues source · line 1894 · raw

@aliases:List<&2, String> -> @+at:String -> @+seen:List<&2, Seen> -> List<&2, Problem>

def sub_alias_entries source · line 1903 · raw

@aliases:List<&2, String> -> List<&2, Seen>

def missing_refs source · line 1909 · raw

@targets:List<&2, String> -> @+ids:List<&2, String> -> @+at:String -> List<&2, Problem>

def valid_u32 source · line 1920 · raw

@s:String -> Bool

A U32 value is what U32.read reads (P22).

def decimal_digits source · line 1924 · raw

@s:String -> Bool

Decimal digits by Nat.read's own test, which Char.is_digit agrees with.

def valid_nat source · line 1932 · raw

@+s:String -> Bool

A Nat value is what Nat.read reads (P22): digits that, less leading zeroes, fit under its cap of 2^48-1.

def valid_bool source · line 1936 · raw

@s:String -> Bool

def is_exponent source · line 1953 · raw

@+c:Char -> Bool

def is_sign source · line 1956 · raw

@+c:Char -> Bool

def decimal_step source · line 1959 · raw

@state:DecimalState -> @+c:Char -> DecimalState

def decimal_accept source · line 1990 · raw

@state:DecimalState -> Bool

def decimal_scan source · line 1998 · raw

@s:String -> @state:DecimalState -> Bool

def valid_f32 source · line 2004 · raw

@s:String -> Bool

def find_one_of source · line 2007 · raw

@items:List<&2, Item> -> Maybe<&2, List<&2, String>>

def find_as source · line 2017 · raw

@attrs:List<&2, Item> -> Maybe<&2, ValueType>

def type_reason source · line 2023 · raw

@kind:ValueType -> @value:String -> Maybe<&2, String>

def quoted_choices source · line 2040 · raw

@values:List<&2, String> -> List<&2, String>

def choices_reason source · line 2046 · raw

@values:List<&2, String> -> String

def choice_reason source · line 2050 · raw

@found:Maybe<&2, List<&2, String>> -> @value:String -> Maybe<&2, String>

def reason_from_type source · line 2059 · raw

@found:Maybe<&2, ValueType> -> @value:String -> Maybe<&2, String>

def first_reason source · line 2065 · raw

@found:Maybe<&2, String> -> @other:Maybe<&2, String> -> Maybe<&2, String>

def value_reason source · line 2071 · raw

@+attrs:List<&2, Item> -> @+value:String -> Maybe<&2, String>

def bad_value source · line 2076 · raw

@reason:Maybe<&2, String> -> @value:String -> Maybe<&2, Bad>

def first_bad source · line 2082 · raw

@values:List<&2, String> -> @+attrs:List<&2, Item> -> Maybe<&2, Bad>

def split_bad source · line 2090 · raw

@found:Maybe<&2, Char> -> @attrs:List<&2, Item> -> @+value:String -> Maybe<&2, Bad>

def value_bad source · line 2097 · raw

@+attrs:List<&2, Item> -> @value:String -> Maybe<&2, Bad>

A delimited value splits first; the first element that fails (§8.2).

def value_issue source · line 2101 · raw

@kind:UsageKind -> @attrs:List<&2, Item> -> @+value:String -> Maybe<&2, Bad>

A value from env or a default converts each element on its own (§8.2).

def bad_default source · line 2109 · raw

@required:Bool -> @issue:Maybe<&2, Bad> -> @value:String -> @id:String -> @at:String -> List<&2, Problem>

def check_default source · line 2116 · raw

@found:Maybe<&2, String> -> @kind:UsageKind -> @+attrs:List<&2, Item> -> @id:String -> @at:String -> List<&2, Problem>

def choice_bad source · line 2126 · raw

@values:List<&2, String> -> @+found:Maybe<&2, ValueType> -> @bad:Maybe<&2, Bad> -> Maybe<&2, Bad>

The first choice the arg's type rejects; after a hit it only walks the rest.

def bad_choice source · line 2134 · raw

@found:Maybe<&2, Bad> -> @id:String -> @at:String -> List<&2, Problem>

def check_choices source · line 2142 · raw

@found:Maybe<&2, List<&2, String>> -> @kind:Maybe<&2, ValueType> -> @id:String -> @at:String -> List<&2, Problem>

Parse checks a value's type before its choices, so a choice the type rejects could never be given.

def positional_issue source · line 2148 · raw

@+kind:UsageKind -> @+id:String -> @attrs:List<&2, Item> -> @rest_items:List<&2, LintItem> -> @+seen_optional:Bool -> @+seen_variadic:Bool -> @+at:String -> List<&2, Problem>

def bare_issue source · line 2165 · raw

@+kind:UsageKind -> @id:String -> @short:String -> @+attrs:List<&2, Item> -> @at:String -> List<&2, Problem>

def misplaced_arg source · line 2174 · raw

@+kind:UsageKind -> @+attrs:List<&2, Item> -> @+at:String -> List<&2, Problem>

def arg_reserved_dup source · line 2179 · raw

@+at:String -> @+long:String -> @seen:List<&2, Seen> -> @id:String -> @short:String -> @version:Bool -> List<&2, Problem>

def arg_issues source · line 2186 · raw

@+kind:UsageKind -> @+id:String -> @+short:String -> @+long:String -> @usage:String -> @help:String -> @+attrs:List<&2, Item> -> @remaining:List<&2, LintItem> -> @+at:String -> @ids:List<&2, String> -> @seen:List<&2, Seen> -> @optional:Bool -> @variadic:Bool -> @version:Bool -> List<&2, Problem>

def arg_problems source · line 2205 · raw

@parsed:Usage -> @+usage:String -> @help:String -> @+attrs:List<&2, Item> -> @remaining:List<&2, LintItem> -> @+at:String -> @ids:List<&2, String> -> @+seen:List<&2, Seen> -> @optional:Bool -> @variadic:Bool -> @+version:Bool -> List<&2, Problem>

def has_external source · line 2223 · raw

@items:List<&2, Item> -> Bool

def has_sub_optional source · line 2229 · raw

@items:List<&2, Item> -> Bool

def needs_sub source · line 2236 · raw

@+items:List<&2, Item> -> Bool

A command that cannot complete without a subcommand (§8.4).

def required_misplaced source · line 2242 · raw

@attrs:List<&2, Item> -> @+at:String -> List<&2, Problem>

Each required() among attrs, as Misplaced at at.

def dead_required_option source · line 2250 · raw

@option:Bool -> @attrs:List<&2, Item> -> @+at:String -> List<&2, Problem>

def dead_required_kind source · line 2258 · raw

@parsed:Usage -> @attrs:List<&2, Item> -> @+at:String -> List<&2, Problem>

An option's required() that descent drops; a flag's or a positional's is already misplaced by its kind.

def dead_required_arg source · line 2265 · raw

@kept:Bool -> @usage:String -> @attrs:List<&2, Item> -> @+at:String -> List<&2, Problem>

def dead_required_items source · line 2271 · raw

@items:List<&2, Item> -> @+at:String -> List<&2, Problem>

def dead_required source · line 2284 · raw

@dead:Bool -> @items:List<&2, Item> -> @+at:String -> List<&2, Problem>

A command that needs a subcommand passes down only its global options' values (§8.4), so another option's required() can never be met.

def command_body_issues source · line 2291 · raw

@+at:String -> @name:String -> @about:String -> @+items:List<&2, Item> -> @has_pos:Bool -> List<&2, Problem>

has_pos: whether items has a positional.

def sub_name_issues source · line 2302 · raw

@+at:String -> @+name:String -> @seen:List<&2, Seen> -> List<&2, Problem>

def lint source · line 2310 · raw

@items:List<&2, LintItem> -> @+at:String -> @+ids:List<&2, String> -> @+seen:List<&2, Seen> -> @+inherited:List<&2, Seen> -> @+optional:Bool -> @+variadic:Bool -> @+version:Bool -> @+root:Bool -> List<&2, Problem>

def problems source · line 2348 · raw

@c:Cmd -> List<&2, Problem>

def host source · line 2428 · raw

@width:Nat -> Host

def host_var source · line 2431 · raw

@h:Host -> @name:String -> @value:String -> Host

def var_value source · line 2436 · raw

@vars:List<&2, Var> -> @+name:String -> Maybe<&2, String>

def host_value source · line 2443 · raw

@h:Host -> @name:String -> Maybe<&2, String>

def arg_info_parsed source · line 2501 · raw

@parsed:Usage -> @usage:String -> @+attrs:List<&2, Item> -> ArgInfo

def arg_info source · line 2510 · raw

@+usage:String -> @attrs:List<&2, Item> -> ArgInfo

def arg_display source · line 2513 · raw

@info:ArgInfo -> String

def short_digit source · line 2520 · raw

@short:String -> Bool

def info_attrs source · line 2525 · raw

@info:ArgInfo -> List<&2, Item>

def info_kind source · line 2529 · raw

@info:ArgInfo -> UsageKind

def info_id source · line 2533 · raw

@info:ArgInfo -> String

def scope_path source · line 2537 · raw

@scope:Scope -> List<&2, String>

def arg_in_group source · line 2541 · raw

@attrs:List<&2, Item> -> @name:String -> Bool

def group_global source · line 2546 · raw

@items:List<&2, Item> -> @+name:String -> Bool

Whether each arg items put in group name is global().

def global_go source · line 2557 · raw

@items:List<&2, Item> -> @+all:List<&2, Item> -> List<&2, Item>

What items pass down to their subcommands, in their order: each global() arg, and each exclusive or need_one rule over a group whose args in all are each global(), so that it holds in every subcommand below.

def global_items source · line 2575 · raw

@+items:List<&2, Item> -> List<&2, Item>

def kind_negatable source · line 2578 · raw

@kind:UsageKind -> Bool

def negated_long source · line 2583 · raw

@long:String -> String

def option_matches source · line 2586 · raw

@+query:String -> @info:ArgInfo -> Maybe<&2, OptFound>

def find_option source · line 2602 · raw

@items:List<&2, Item> -> @+query:String -> Maybe<&2, OptFound>

def key_found source · line 2613 · raw

@key:OptKey -> @query:String -> Maybe<&2, OptFound>

def find_key source · line 2620 · raw

@keys:List<&2, OptKey> -> @+query:String -> @found:Maybe<&2, OptFound> -> Maybe<&2, OptFound>

The first key named query; after a hit it only walks the rest.

def find_option_scope source · line 2628 · raw

@scope:Scope -> @query:String -> Maybe<&2, OptFound>

A scope's own args answer before its globals, as in find_option.

def has_alias source · line 2636 · raw

@items:List<&2, Item> -> @+query:String -> @found:Bool -> Bool

Whether items alias query; after a hit it walks no further.

def alias_hit source · line 2644 · raw

@aliased:Bool -> @name:String -> @children:List<&2, Item> -> Maybe<&2, SubFound>

def sub_hit source · line 2650 · raw

@same:Bool -> @name:String -> @+children:List<&2, Item> -> @query:String -> Maybe<&2, SubFound>

def sub_found source · line 2657 · raw

@item:Item -> @+query:String -> Maybe<&2, SubFound>

def find_sub_go source · line 2664 · raw

@items:List<&2, Item> -> @+query:String -> @found:Maybe<&2, SubFound> -> Maybe<&2, SubFound>

The first Sub named or aliased query; after a hit it walks no further.

def find_sub source · line 2671 · raw

@items:List<&2, Item> -> @+query:String -> Maybe<&2, SubFound>

def positional_items source · line 2675 · raw

@items:List<&2, Item> -> List<&2, Item>

def has_variadic_pos source · line 2685 · raw

@items:List<&2, Item> -> Bool

def positional_can_take source · line 2693 · raw

@items:List<&2, Item> -> @count:Nat -> Bool

def next_slot source · line 2698 · raw

@slots:List<&2, ArgInfo> -> @+count:Nat -> Maybe<&2, ArgInfo>

def scope_next_slot source · line 2707 · raw

@scope:Scope -> @count:Nat -> Maybe<&2, ArgInfo>

def opt_key source · line 2715 · raw

@+name:String -> @info:ArgInfo -> OptKey

name as a key of info; only info's --no- long clears the flag, as in option_matches.

def name_keys source · line 2723 · raw

@names:List<&2, String> -> @+info:ArgInfo -> List<&2, OptKey>

def nonempty_name source · line 2729 · raw

@+name:String -> List<&2, String>

def info_names source · line 2733 · raw

@info:ArgInfo -> List<&2, String>

The names option_matches accepts for info, in its order.

def spec_keys source · line 2743 · raw

@items:List<&2, SpecItem> -> List<&2, OptKey>

def spec_items source · line 2752 · raw

@items:List<&2, Item> -> List<&2, SpecItem>

items less their Subs, each Arg's usage parsed once.

def global_spec source · line 2761 · raw

@items:List<&2, SpecItem> -> @+all:List<&2, Item> -> List<&2, SpecItem>

global_go over items parsed, with all as written.

def spec_slots source · line 2780 · raw

@items:List<&2, SpecItem> -> List<&2, ArgInfo>

def slots_variadic source · line 2789 · raw

@slots:List<&2, ArgInfo> -> Bool

def info_digit_short source · line 2795 · raw

@info:ArgInfo -> Bool

def spec_digit_short source · line 2799 · raw

@items:List<&2, SpecItem> -> Bool

def raw_subs source · line 2806 · raw

@items:List<&2, Item> -> List<&2, SubKey>

def spec_node source · line 2815 · raw

@+items:List<&2, Item> -> @+globals:List<&2, SpecItem> -> Spec

items as a scope inheriting globals; its subcommands stay unparsed until the scan enters one.

def scan_start source · line 2826 · raw

@c:Cmd -> ScanState

def scan_event source · line 2832 · raw

@state:ScanState -> @event:ScanEvent -> ScanState

def first_issue source · line 2839 · raw

@issue:Maybe<&2, ScanFault> -> @fault:ScanFault -> Maybe<&2, ScanFault>

def scan_error source · line 2845 · raw

@state:ScanState -> @fault:ScanFault -> ScanState

def has_hyphen source · line 2852 · raw

@items:List<&2, Item> -> Bool

def slot_rest source · line 2858 · raw

@found:Maybe<&2, ArgInfo> -> Bool

def slot_hyphen source · line 2864 · raw

@found:Maybe<&2, ArgInfo> -> Bool

def has_as_f32 source · line 2870 · raw

@items:List<&2, Item> -> Bool

def slot_f32 source · line 2876 · raw

@found:Maybe<&2, ArgInfo> -> Bool

def is_negative_number source · line 2882 · raw

@+s:String -> Bool

def before_equal source · line 2885 · raw

@s:String -> String

def after_equal source · line 2891 · raw

@s:String -> Maybe<&2, String>

def first_option_name source · line 2897 · raw

@+token:String -> String

def scope_option_known source · line 2901 · raw

@scope:Scope -> @token:String -> Bool

def scope_builtin_known source · line 2905 · raw

@scope:Scope -> @+token:String -> Bool

def scope_any_option_known source · line 2917 · raw

@+scope:Scope -> @+token:String -> Bool

def scan_operand_ok source · line 2921 · raw

@state:ScanState -> @token:String -> ScanState

def scan_operand_case source · line 2930 · raw

@allowed:Bool -> @state:ScanState -> @token:String -> ScanState

def scope_can_take source · line 2936 · raw

@scope:Scope -> @count:Nat -> Bool

def scan_operand source · line 2942 · raw

@state:ScanState -> @token:String -> ScanState

def spec_inherit source · line 2950 · raw

@spec:Spec -> List<&2, SpecItem>

def event_id source · line 2955 · raw

@event:ScanEvent -> Maybe<&2, String>

def spec_info_found source · line 2962 · raw

@item:SpecItem -> @id:String -> Maybe<&2, ArgInfo>

def find_spec_info source · line 2970 · raw

@items:List<&2, SpecItem> -> @+id:String -> @found:Maybe<&2, ArgInfo> -> Maybe<&2, ArgInfo>

find_arg_info over parsed items; after a hit it only walks the rest.

def event_inherited source · line 2981 · raw

@found:Maybe<&2, String> -> @+globals:List<&2, SpecItem> -> Bool

An arg's hits from before the scan enters a subcommand stay only when the scope being left passes the arg down as a global (SPEC 8.4); operands, entries, help and version stay.

def events_kept source · line 2988 · raw

@keep:Bool -> @event:ScanEvent -> @rest:List<&2, ScanEvent> -> List<&2, ScanEvent>

def events_inherited source · line 2994 · raw

@events:List<&2, ScanEvent> -> @+globals:List<&2, SpecItem> -> List<&2, ScanEvent>

def scan_descend source · line 3002 · raw

@state:ScanState -> @sub:SubKey -> ScanState

def scan_external source · line 3017 · raw

@state:ScanState -> @name:String -> @args:List<&2, String> -> ScanState

def scan_value_result source · line 3026 · raw

@found:Maybe<&2, Bad> -> @state:ScanState -> @info:ArgInfo -> @value:String -> ScanState

E04 quotes the first element that fails.

def scan_value source · line 3036 · raw

@state:ScanState -> @+info:ArgInfo -> @+value:String -> ScanState

def scan_simple_hit source · line 3040 · raw

@state:ScanState -> @info:ArgInfo -> @polarity:Bool -> ScanState

def scan_settle_case source · line 3048 · raw

@resting:Bool -> @issue:Maybe<&2, ScanFault> -> @scope:Scope -> @events:List<&2, ScanEvent> -> @positional_count:Nat -> @external:Maybe<&2, ExternalArgs> -> Mode

def scan_settle source · line 3065 · raw

@state:ScanState -> Mode

def help_flag_case source · line 3072 · raw

@long:Bool -> @short:Bool -> Maybe<&2, Bool>

def help_flag source · line 3079 · raw

@+token:String -> Maybe<&2, Bool>

Which help flag a token is: Some{True{}} for --help, Some{False{}} for -h.

def scan_faulted_case source · line 3082 · raw

@help:Maybe<&2, Bool> -> @state:ScanState -> Tail

def scan_faulted source · line 3087 · raw

@state:ScanState -> @token:String -> Tail

def scope_digit_short source · line 3090 · raw

@scope:Scope -> Bool

def arg_has_hyphen source · line 3095 · raw

@info:ArgInfo -> Bool

def arg_is_f32 source · line 3100 · raw

@info:ArgInfo -> Bool

def fetch_allowed source · line 3105 · raw

@scope:Scope -> @+info:ArgInfo -> @+token:String -> Bool

def scan_fetch_result source · line 3115 · raw

@allowed:Bool -> @state:ScanState -> @info:ArgInfo -> @token:String -> Mode

def scan_state_scope source · line 3122 · raw

@state:ScanState -> Scope

def scan_fetch source · line 3127 · raw

@+state:ScanState -> @+info:ArgInfo -> @+token:String -> Mode

def bare_value source · line 3132 · raw

@attrs:List<&2, Item> -> String

def scan_option source · line 3138 · raw

@attached:Maybe<&2, String> -> @state:ScanState -> @info:ArgInfo -> Mode

def info_bare_value source · line 3144 · raw

@info:ArgInfo -> String

def scan_bare_option source · line 3149 · raw

@attached:Maybe<&2, String> -> @state:ScanState -> @+info:ArgInfo -> Mode

def scan_simple_option source · line 3156 · raw

@attached:Maybe<&2, String> -> @state:ScanState -> @info:ArgInfo -> @polarity:Bool -> Mode

def scan_found_kind source · line 3163 · raw

@kind:UsageKind -> @attached:Maybe<&2, String> -> @state:ScanState -> @info:ArgInfo -> @polarity:Bool -> Mode

def scan_found source · line 3179 · raw

@found:OptFound -> @attached:Maybe<&2, String> -> @state:ScanState -> Mode

def scope_version source · line 3185 · raw

@scope:Scope -> Bool

def scan_builtin_hit source · line 3191 · raw

@attached:Maybe<&2, String> -> @state:ScanState -> @event:ScanEvent -> @name:String -> Mode

def scan_builtin_version source · line 3197 · raw

@enabled:Bool -> @attached:Maybe<&2, String> -> @state:ScanState -> Mode

def scan_builtin_other source · line 3205 · raw

@version:Bool -> @name:String -> @attached:Maybe<&2, String> -> @+state:ScanState -> Mode

def scan_builtin_long_case source · line 3213 · raw

@help:Bool -> @+name:String -> @attached:Maybe<&2, String> -> @state:ScanState -> Mode

def scan_builtin_long source · line 3221 · raw

@+name:String -> @attached:Maybe<&2, String> -> @state:ScanState -> Mode

def scan_long_found source · line 3225 · raw

@found:Maybe<&2, OptFound> -> @name:String -> @attached:Maybe<&2, String> -> @state:ScanState -> Mode

def scan_long source · line 3231 · raw

@+token:String -> @+state:ScanState -> Mode

def find_short_for_head source · line 3236 · raw

@chars:String -> @state:ScanState -> Maybe<&2, OptFound>

def short_attached source · line 3244 · raw

@chars:String -> String

def scan_short_value_attached source · line 3249 · raw

@value:String -> @state:ScanState -> @info:ArgInfo -> Mode

def scan_short_value source · line 3255 · raw

@chars:String -> @state:ScanState -> @info:ArgInfo -> Mode

def scan_short_bare_value source · line 3259 · raw

@chars:String -> @state:ScanState -> @+info:ArgInfo -> Mode

def scan_short_version source · line 3267 · raw

@enabled:Bool -> @state:ScanState -> Mode

def scan_short_go source · line 3272 · raw

@chars:String -> @+state:ScanState -> @found:Maybe<&2, OptFound> -> Mode

def scan_short source · line 3306 · raw

@token:String -> @+state:ScanState -> Mode

def scope_external source · line 3310 · raw

@scope:Scope -> Bool

def scope_has_sub source · line 3315 · raw

@scope:Scope -> Bool

def sub_key_aliased source · line 3320 · raw

@aliased:Bool -> @name:String -> @aliases:List<&2, String> -> @children:List<&2, Item> -> Maybe<&2, SubKey>

def sub_key_hit source · line 3326 · raw

@same:Bool -> @name:String -> @+aliases:List<&2, String> -> @children:List<&2, Item> -> @query:String -> Maybe<&2, SubKey>

def sub_key_found source · line 3334 · raw

@key:SubKey -> @+query:String -> Maybe<&2, SubKey>

def find_sub_key source · line 3340 · raw

@subs:List<&2, SubKey> -> @+query:String -> @found:Maybe<&2, SubKey> -> Maybe<&2, SubKey>

find_sub over a scope's subcommands; after a hit it only walks the rest.

def scope_find_sub source · line 3348 · raw

@scope:Scope -> @query:String -> Maybe<&2, SubKey>

def scan_sub_unknown source · line 3354 · raw

@allow_external:Bool -> @state:ScanState -> @token:String -> Mode

def scan_sub_found source · line 3360 · raw

@found:Maybe<&2, SubKey> -> @+state:ScanState -> @token:String -> Mode

def unknown_fault source · line 3368 · raw

@dash:Bool -> @token:String -> ScanFault

def help_missing_case source · line 3373 · raw

@help:Maybe<&2, Bool> -> @+token:String -> @state:ScanState -> Tail

def help_missing source · line 3381 · raw

@+token:String -> @state:ScanState -> Tail

def help_walk source · line 3384 · raw

@found:Maybe<&2, SubKey> -> @state:ScanState -> @token:String -> Tail

def scan_non_option_sub_case source · line 3390 · raw

@help:Bool -> @+token:String -> @+state:ScanState -> Mode

def scan_non_option_sub source · line 3398 · raw

@+token:String -> @state:ScanState -> Mode

def scan_non_option_case source · line 3401 · raw

@has_sub:Bool -> @token:String -> @state:ScanState -> Mode

def scan_non_option source · line 3407 · raw

@token:String -> @+state:ScanState -> Mode

def scan_hyphen_candidate source · line 3410 · raw

@state:ScanState -> @+token:String -> Bool

def scan_dash_case source · line 3421 · raw

@operand:Bool -> @token:String -> @state:ScanState -> Mode

def scan_dash_token source · line 3426 · raw

@+token:String -> @+state:ScanState -> Mode

def token_class source · line 3436 · raw

@token:String -> TokenClass

def scan_token_case source · line 3443 · raw

@kind:TokenClass -> @token:String -> @state:ScanState -> Mode

def scan_token source · line 3450 · raw

@+token:String -> @state:ScanState -> Mode

def scan_tail source · line 3453 · raw

@tail:Tail -> @+token:String -> Tail

def scan_open source · line 3462 · raw

@dash:Bool -> @state:ScanState -> @token:String -> Mode

-- ends options only here, while the scan is open (R1).

def scan_go source · line 3468 · raw

@tokens:List<&2, String> -> @mode:Mode -> Mode

An external subcommand takes the rest of argv verbatim.

def scan_tail_close source · line 3482 · raw

@tail:Tail -> ScanState

def scan_close source · line 3488 · raw

@mode:Mode -> ScanState

def scan_trace_of source · line 3496 · raw

@state:ScanState -> @ended:Bool -> ScanTrace

def scan_trace source · line 3505 · raw

@mode:Mode -> ScanTrace

def scan source · line 3510 · raw

@c:Cmd -> @argv:List<&2, String> -> ScanTrace

def find_early source · line 3513 · raw

@events:List<&2, ScanEvent> -> Maybe<&2, Early>

def scope_needs_sub source · line 3520 · raw

@scope:Scope -> Bool

def bool_text source · line 3525 · raw

@value:Bool -> String

def gather_value source · line 3528 · raw

@gather:Gather -> @+value:String -> @many:Bool -> Gather

def gather_flag source · line 3536 · raw

@gather:Gather -> @value:Bool -> Gather

def gather_count source · line 3541 · raw

@gather:Gather -> Gather

def kind_many source · line 3547 · raw

@kind:UsageKind -> Bool

def gather_event source · line 3553 · raw

@event:ScanEvent -> @id:String -> @kind:UsageKind -> @+gather:Gather -> Gather

def gather_events source · line 3567 · raw

@events:List<&2, ScanEvent> -> @+id:String -> @+kind:UsageKind -> @gather:Gather -> Gather

def gather_arg source · line 3575 · raw

@events:List<&2, ScanEvent> -> @info:ArgInfo -> Gather

def find_envs source · line 3581 · raw

@attrs:List<&2, Item> -> List<&2, String>

Each env() name, in order.

def env_present source · line 3587 · raw

@name:String -> @found:Maybe<&2, String> -> Maybe<&2, EnvValue>

def env_next source · line 3596 · raw

@found:Maybe<&2, EnvValue> -> @+name:String -> @vars:List<&2, Var> -> Maybe<&2, EnvValue>

found, or else name's value in vars if it is set and not empty.

def env_first source · line 3603 · raw

@names:List<&2, String> -> @found:Maybe<&2, EnvValue> -> @+vars:List<&2, Var> -> Maybe<&2, EnvValue>

found, or else the first of names that is set and not empty in vars.

def host_env source · line 3609 · raw

@h:Host -> @names:List<&2, String> -> Maybe<&2, EnvValue>

def env_bool_true source · line 3614 · raw

@value:String -> Bool

def env_values source · line 3618 · raw

@kind:UsageKind -> @attrs:List<&2, Item> -> @value:String -> List<&2, String>

def resolve_env_valid source · line 3626 · raw

@found:Maybe<&2, Bad> -> @info:ArgInfo -> @name:String -> @value:String -> FieldBuild

def resolve_env source · line 3636 · raw

@+info:ArgInfo -> @env:EnvValue -> FieldBuild

def resolve_default source · line 3642 · raw

@found:Maybe<&2, String> -> @info:ArgInfo -> FieldBuild

def info_default source · line 3651 · raw

@info:ArgInfo -> Maybe<&2, String>

def resolve_env_default source · line 3656 · raw

@found:Maybe<&2, EnvValue> -> @+info:ArgInfo -> FieldBuild

def info_envs source · line 3662 · raw

@info:ArgInfo -> List<&2, String>

def resolve_argv_gather source · line 3667 · raw

@gather:Gather -> @+info:ArgInfo -> @h:Host -> FieldBuild

def resolve_option source · line 3678 · raw

@+info:ArgInfo -> @events:List<&2, ScanEvent> -> @h:Host -> FieldBuild

def scope_arg_items source · line 3682 · raw

@scope:Scope -> List<&2, SpecItem>

def combine_built source · line 3687 · raw

@fields:List<&2, Field> -> @next:FieldBuild -> FieldBuild

def combine_build source · line 3694 · raw

@first:FieldBuild -> @second:FieldBuild -> FieldBuild

def resolve_arg source · line 3700 · raw

@pos:Bool -> @+info:ArgInfo -> @events:List<&2, ScanEvent> -> @h:Host -> @later:FieldBuild -> FieldBuild

def resolve_options source · line 3706 · raw

@items:List<&2, SpecItem> -> @+events:List<&2, ScanEvent> -> @+h:Host -> FieldBuild

def scan_operands source · line 3715 · raw

@events:List<&2, ScanEvent> -> List<&2, String>

def position_take_count source · line 3723 · raw

@kind:UsageKind -> @after:List<&2, ArgInfo> -> @+tokens:List<&2, String> -> Nat

def pos_valid_result source · line 3732 · raw

@found:Maybe<&2, Bad> -> @info:ArgInfo -> @values:List<&2, String> -> FieldBuild

def resolve_pos source · line 3742 · raw

@+info:ArgInfo -> @+values:List<&2, String> -> @h:Host -> FieldBuild

def resolve_positions source · line 3752 · raw

@slots:List<&2, ArgInfo> -> @+tokens:List<&2, String> -> @+h:Host -> FieldBuild

def scope_positions source · line 3762 · raw

@scope:Scope -> List<&2, ArgInfo>

def resolve_scope source · line 3767 · raw

@+scope:Scope -> @+events:List<&2, ScanEvent> -> @+h:Host -> FieldBuild

def source_given source · line 3774 · raw

@source:Src -> Bool

def field_source source · line 3781 · raw

@fields:List<&2, Field> -> @+id:String -> Src

def field_given source · line 3788 · raw

@fields:List<&2, Field> -> @id:String -> Bool

def source_present source · line 3791 · raw

@source:Src -> Bool

def field_present source · line 3796 · raw

@fields:List<&2, Field> -> @id:String -> Bool

def group_usages source · line 3799 · raw

@items:List<&2, Item> -> @+name:String -> List<&2, String>

def spec_group_usages source · line 3809 · raw

@items:List<&2, SpecItem> -> @+name:String -> List<&2, String>

def spec_group_display source · line 3820 · raw

@items:List<&2, SpecItem> -> @name:String -> String

def group_given source · line 3823 · raw

@items:List<&2, SpecItem> -> @+fields:List<&2, Field> -> @+name:String -> Bool

def arg_required_missing source · line 3832 · raw

@info:ArgInfo -> @+fields:List<&2, Field> -> Bool

def group_display source · line 3841 · raw

@items:List<&2, Item> -> @name:String -> String

def missing_arg source · line 3844 · raw

@+info:ArgInfo -> @fields:List<&2, Field> -> List<&2, String>

def missing_group source · line 3850 · raw

@+items:List<&2, SpecItem> -> @fields:List<&2, Field> -> @+name:String -> List<&2, String>

def missing_once source · line 3857 · raw

@listed:Bool -> @items:List<&2, SpecItem> -> @fields:List<&2, Field> -> @name:String -> List<&2, String>

A group's display the first time a need_one rule names it.

def missing_items source · line 3865 · raw

@items:List<&2, SpecItem> -> @+all_items:List<&2, SpecItem> -> @+fields:List<&2, Field> -> @+done:List<&2, String> -> List<&2, String>

What E06 lists, in items' order: each required arg not given, and each need_one group with no arg given that done does not name yet.

def scope_missing source · line 3883 · raw

@scope:Scope -> @fields:List<&2, Field> -> List<&2, String>

def append_unique source · line 3888 · raw

@+ids:List<&2, String> -> @+id:String -> List<&2, String>

def append_event_id source · line 3894 · raw

@found:Maybe<&2, String> -> @ids:List<&2, String> -> List<&2, String>

def argv_order source · line 3900 · raw

@events:List<&2, ScanEvent> -> @ids:List<&2, String> -> List<&2, String>

def source_env source · line 3907 · raw

@source:Src -> Bool

def env_order source · line 3912 · raw

@fields:List<&2, Field> -> @+ids:List<&2, String> -> List<&2, String>

def present_order source · line 3920 · raw

@events:List<&2, ScanEvent> -> @fields:List<&2, Field> -> List<&2, String>

def arg_info_found source · line 3924 · raw

@item:Item -> @id:String -> Maybe<&2, ArgInfo>

def find_arg_go source · line 3933 · raw

@items:List<&2, Item> -> @+id:String -> @found:Maybe<&2, ArgInfo> -> Maybe<&2, ArgInfo>

The first Arg whose id is id; after a hit it walks no further.

def find_arg_info source · line 3940 · raw

@items:List<&2, Item> -> @+id:String -> Maybe<&2, ArgInfo>

def exclusive_groups source · line 3944 · raw

@items:List<&2, SpecItem> -> List<&2, String>

def common_exclusive source · line 3951 · raw

@groups:List<&2, String> -> @+left:List<&2, String> -> @+right:List<&2, String> -> Bool

def pair_conflicts source · line 3961 · raw

@+later:ArgInfo -> @+earlier:ArgInfo -> @groups:List<&2, String> -> Bool

def pair_fault source · line 3973 · raw

@+later:ArgInfo -> @earlier:Maybe<&2, ArgInfo> -> @groups:List<&2, String> -> Maybe<&2, ScanFault>

def earlier_conflict source · line 3982 · raw

@earlier_ids:List<&2, String> -> @+later:ArgInfo -> @+items:List<&2, SpecItem> -> @+groups:List<&2, String> -> @found:Maybe<&2, ScanFault> -> Maybe<&2, ScanFault>

def conflict_for_id source · line 3994 · raw

@info:Maybe<&2, ArgInfo> -> @seen:List<&2, String> -> @items:List<&2, SpecItem> -> @groups:List<&2, String> -> Maybe<&2, ScanFault>

def conflict_go source · line 4002 · raw

@ids:List<&2, String> -> @+seen:List<&2, String> -> @+items:List<&2, SpecItem> -> @+groups:List<&2, String> -> @found:Maybe<&2, ScanFault> -> Maybe<&2, ScanFault>

def require_target_fault source · line 4016 · raw

@target:Maybe<&2, ArgInfo> -> @+requester:ArgInfo -> @fields:List<&2, Field> -> Maybe<&2, ScanFault>

def require_targets source · line 4027 · raw

@targets:List<&2, String> -> @+requester:ArgInfo -> @+items:List<&2, SpecItem> -> @+fields:List<&2, Field> -> @found:Maybe<&2, ScanFault> -> Maybe<&2, ScanFault>

def require_for_id source · line 4040 · raw

@info:Maybe<&2, ArgInfo> -> @items:List<&2, SpecItem> -> @fields:List<&2, Field> -> Maybe<&2, ScanFault>

def require_go source · line 4049 · raw

@ids:List<&2, String> -> @+items:List<&2, SpecItem> -> @+fields:List<&2, Field> -> @found:Maybe<&2, ScanFault> -> Maybe<&2, ScanFault>

def parse_requires source · line 4060 · raw

@fault:Maybe<&2, ScanFault> -> @path:List<&2, String> -> @fields:List<&2, Field> -> @external:Maybe<&2, ExternalArgs> -> ParseResult

def parse_conflicts source · line 4067 · raw

@fault:Maybe<&2, ScanFault> -> @+scope:Scope -> @+fields:List<&2, Field> -> @events:List<&2, ScanEvent> -> @external:Maybe<&2, ExternalArgs> -> ParseResult

def parse_missing source · line 4079 · raw

@missing:List<&2, String> -> @+scope:Scope -> @+fields:List<&2, Field> -> @+events:List<&2, ScanEvent> -> @empty:Bool -> @external:Maybe<&2, ExternalArgs> -> ParseResult

def parse_built source · line 4093 · raw

@build:FieldBuild -> @+scope:Scope -> @events:List<&2, ScanEvent> -> @empty:Bool -> @external:Maybe<&2, ExternalArgs> -> ParseResult

def parse_no_issue source · line 4102 · raw

@needs_sub:Bool -> @+scope:Scope -> @+events:List<&2, ScanEvent> -> @+h:Host -> @+empty:Bool -> @external:Maybe<&2, ExternalArgs> -> ParseResult

def parse_issue source · line 4111 · raw

@issue:Maybe<&2, ScanFault> -> @+scope:Scope -> @events:List<&2, ScanEvent> -> @h:Host -> @empty:Bool -> @external:Maybe<&2, ExternalArgs> -> ParseResult

def parse_early source · line 4121 · raw

@found:Maybe<&2, Early> -> @+scope:Scope -> @events:List<&2, ScanEvent> -> @h:Host -> @empty:Bool -> @issue:Maybe<&2, ScanFault> -> @external:Maybe<&2, ExternalArgs> -> ParseResult

def parse_from_state source · line 4133 · raw

@state:ScanState -> @h:Host -> @empty:Bool -> ParseResult

def parse source · line 4143 · raw

@c:Cmd -> @h:Host -> @+argv:List<&2, String> -> ParseResult

def Dec source · line 4153 · raw

@-A:Type -> Type

def Dec.pure source · line 4156 · raw

@-A:Type -> @x:A -> Dec(A)

def Dec.bind source · line 4159 · raw

@-A:Type -> @-B:Type -> @r:Dec(A) -> @f:(@_:A -> Dec(B)) -> Dec(B)

def matches source · line 4168 · raw

@c:Cmd -> @r:ParseResult -> Maybe<&2, Matches>

def path source · line 4174 · raw

@m:Matches -> List<&2, String>

def external_args source · line 4178 · raw

@m:Matches -> Maybe<&1, Pair(String, List<&2, String>)>

def fail source · line 4184 · raw

@-A:Type -> @msg:String -> Dec(A)

def bug source · line 4187 · raw

@-A:Type -> @msg:String -> Dec(A)

def keep source · line 4190 · raw

@+m:Matches -> Dec(Matches)

def path_text source · line 4194 · raw

@name:String -> @path:List<&2, String> -> String

A command path as lint writes it: the root name, then each subcommand.

def sub_items source · line 4197 · raw

@found:Maybe<&2, SubFound> -> List<&2, Item>

def scope_args source · line 4203 · raw

@path:List<&2, String> -> @+items:List<&2, Item> -> @globals:List<&2, Item> -> List<&2, Item>

The args in scope at path (§8.1), as parse orders them: globals first.

def kind_flag source · line 4224 · raw

@kind:UsageKind -> Bool

def kind_count source · line 4230 · raw

@kind:UsageKind -> Bool

def type_stem source · line 4236 · raw

@found:Maybe<&2, ValueType> -> String

The reader name a value type reads with: str, nat, u32, f32 or bool.

def stem_noun source · line 4244 · raw

@+stem:String -> String

def stem_article source · line 4247 · raw

@+stem:String -> String

def always_present source · line 4250 · raw

@kind:UsageKind -> @+attrs:List<&2, Item> -> Bool

def may_absent source · line 4254 · raw

@+kind:UsageKind -> @attrs:List<&2, Item> -> Bool

def kind_text source · line 4258 · raw

@kind:UsageKind -> @+stem:String -> String

def fit_name source · line 4268 · raw

@+kind:UsageKind -> @attrs:List<&2, Item> -> @+stem:String -> String

def kind_verdict source · line 4279 · raw

@fits:Bool -> @id:String -> @+kind:UsageKind -> @+attrs:List<&2, Item> -> Maybe<&2, String>

def absent_verdict source · line 4288 · raw

@absent:Bool -> @id:String -> @reader:String -> Maybe<&2, String>

def all_in source · line 4296 · raw

@xs:List<&2, String> -> @+ys:List<&2, String> -> Bool

def keys_issue source · line 4303 · raw

@same:Bool -> @id:String -> Maybe<&2, String>

def keys_verdict source · line 4310 · raw

@found:Maybe<&2, List<&2, String>> -> @+keys:List<&2, String> -> @id:String -> Maybe<&2, String>

def form_fits source · line 4318 · raw

@form:Form -> @many:Bool -> Bool

def form_one source · line 4323 · raw

@form:Form -> Bool

def value_fits source · line 4328 · raw

@stem:String -> @form:Form -> @+kind:UsageKind -> @attrs:List<&2, Item> -> Bool

def choose_fits source · line 4334 · raw

@+kind:UsageKind -> @attrs:List<&2, Item> -> Bool

def want_verdict source · line 4339 · raw

@want:Want -> @+id:String -> @+kind:UsageKind -> @+attrs:List<&2, Item> -> Maybe<&2, String>

The first Q-static message for an arg in scope: kind, absence, then keys.

def arg_verdict source · line 4361 · raw

@found:Maybe<&2, ArgInfo> -> @id:String -> @name:String -> @path:List<&2, String> -> @want:Want -> Maybe<&2, String>

def verdict source · line 4371 · raw

@cmd:Cmd -> @+path:List<&2, String> -> @+id:String -> @want:Want -> Maybe<&2, String>

Q-static: depends only on the spec, the path, the id and the want.

def field_found source · line 4378 · raw

@f:Field -> @id:String -> Maybe<&2, Field>

def field_seek source · line 4385 · raw

@fields:List<&2, Field> -> @+id:String -> @found:Maybe<&2, Field> -> Field

The field for id, or an absent one; after a hit it walks no further.

def field_find source · line 4392 · raw

@fields:List<&2, Field> -> @+id:String -> Field

def true_of source · line 4428 · raw

@s:String -> Bool

def nat_of source · line 4431 · raw

@s:String -> Nat

def u32_of source · line 4434 · raw

@s:String -> U32

def f32_of source · line 4437 · raw

@s:String -> F32

def flag source · line 4440 · raw

@m:Matches -> @id:String -> Dec(Bool)

def count source · line 4443 · raw

@m:Matches -> @id:String -> Dec(Nat)

def str source · line 4447 · raw

@m:Matches -> @id:String -> Dec(String)

def str_opt source · line 4451 · raw

@m:Matches -> @id:String -> Dec(Maybe<&2, String>)

def strs source · line 4455 · raw

@m:Matches -> @id:String -> Dec(List<&2, String>)

def nat source · line 4459 · raw

@m:Matches -> @id:String -> Dec(Nat)

def nat_opt source · line 4463 · raw

@m:Matches -> @id:String -> Dec(Maybe<&2, Nat>)

def nats source · line 4467 · raw

@m:Matches -> @id:String -> Dec(List<&2, Nat>)

def u32 source · line 4471 · raw

@m:Matches -> @id:String -> Dec(U32)

def u32_opt source · line 4475 · raw

@m:Matches -> @id:String -> Dec(Maybe<&2, U32>)

def u32s source · line 4479 · raw

@m:Matches -> @id:String -> Dec(List<&2, U32>)

def f32 source · line 4483 · raw

@m:Matches -> @id:String -> Dec(F32)

def f32_opt source · line 4487 · raw

@m:Matches -> @id:String -> Dec(Maybe<&2, F32>)

def f32s source · line 4491 · raw

@m:Matches -> @id:String -> Dec(List<&2, F32>)

def bool source · line 4495 · raw

@m:Matches -> @id:String -> Dec(Bool)

def bool_opt source · line 4499 · raw

@m:Matches -> @id:String -> Dec(Maybe<&2, Bool>)

def bools source · line 4503 · raw

@m:Matches -> @id:String -> Dec(List<&2, Bool>)

def field_src source · line 4507 · raw

@f:Field -> Src

def given source · line 4511 · raw

@m:Matches -> @id:String -> Dec(Bool)

def source source · line 4514 · raw

@m:Matches -> @id:String -> Dec(Src)

def by_key_hit source · line 4517 · raw

@-a:Quant -> @-A:Kind(a) -> @same:Bool -> @value:A -> Maybe<a, A>

def find_by_key_go source · line 4523 · raw

@-a:Quant -> @-A:Kind(a) -> @keys:List<&2, String> -> @values:List<a, A> -> @+key:String -> @found:Maybe<a, A> -> Maybe<a, A>

The value under the first key equal to key; after a hit it walks no further.

def find_by_key source · line 4532 · raw

@-a:Quant -> @-A:Kind(a) -> @keys:List<&2, String> -> @values:List<a, A> -> @+key:String -> Maybe<a, A>

def keyed_cons source · line 4536 · raw

@-a:Quant -> @-A:Kind(a) -> @key:String -> @value:A -> @rest:Pair(List<&2, String>, List<a, A>) -> Pair(List<&2, String>, List<a, A>)

def unzip_keyed source · line 4542 · raw

@-a:Quant -> @-A:Kind(a) -> @table:List<&1, Pair(String, A)> -> Pair(List<&2, String>, List<a, A>)

A choose or route table as its keys and its values.

def choice_dec source · line 4551 · raw

@-A:Data -> @found:Maybe<&2, A> -> Dec(Maybe<&2, A>)

After validation the key exists: parse and samples keep one_of values.

def choose_read source · line 4556 · raw

@-A:Data -> @keys:List<&2, String> -> @values:List<&2, A> -> @f:Field -> Dec(Maybe<&2, A>)

def choose_check source · line 4563 · raw

@-A:Data -> @verdict:Maybe<&2, String> -> @keys:List<&2, String> -> @values:List<&2, A> -> @fields:List<&2, Field> -> @id:String -> Dec(Maybe<&2, A>)

def choose_pick source · line 4570 · raw

@-A:Data -> @opt:Bool -> @choices:Pair(List<&2, String>, List<&2, A>) -> @m:Matches -> @+id:String -> Dec(Maybe<&2, A>)

def choose_opt source · line 4579 · raw

@-A:Data -> @m:Matches -> @id:String -> @table:List<&1, Pair(String, A)> -> Dec(Maybe<&2, A>)

def choice_must source · line 4584 · raw

@-A:Data -> @d:Dec(Maybe<&2, A>) -> Dec(A)

After validation a bare choose always has a value.

def choose source · line 4590 · raw

@-A:Data -> @m:Matches -> @id:String -> @table:List<&1, Pair(String, A)> -> Dec(A)

def Call source · line 4594 · raw

@-A:Type -> Type

def word_rest source · line 4600 · raw

@name:String -> @text:String -> @same:Bool -> Maybe<&2, Maybe<&2, String>>

Some{None{}} when text is the word name, Some{Some{rest}} when it is name, a space and rest, None{} otherwise. Words are cut at spaces, so a name with a space (Chr{32}) is no word.

def key_user source · line 4619 · raw

@builtin:Bool -> @rest:Maybe<&2, String> -> KeyStep

def key_word source · line 4625 · raw

@found:Maybe<&2, Maybe<&2, String>> -> @children:List<&2, Item> -> KeyStep

def key_step source · line 4631 · raw

@items:List<&2, Item> -> @text:String -> KeyStep

def key_go source · line 4639 · raw

@items:List<&2, Item> -> @+text:String -> @step:KeyStep -> Bool

The first subcommand named by each word of text, from items down, is a command.

def route_text source · line 4649 · raw

@empty:Bool -> @+key:String -> @+items:List<&2, Item> -> Bool

def route_key source · line 4655 · raw

@+key:String -> @items:List<&2, Item> -> Bool

A route key's words name a command; "" is the root.

def non_command source · line 4658 · raw

@keys:List<&2, String> -> @+items:List<&2, Item> -> Maybe<&2, String>

def route_call source · line 4666 · raw

@-A:Type -> @bad:Maybe<&2, String> -> @call:Call(A) -> @m:Matches -> Dec(A)

def route_found source · line 4674 · raw

@-A:Type -> @found:Maybe<&1, Call(A)> -> @keys:List<&2, String> -> @cmd:Cmd -> @path:List<&2, String> -> @m:Matches -> Dec(A)

No route for the path is checked first, then every key names a command.

def route_pick source · line 4682 · raw

@-A:Type -> @routes:Pair(List<&2, String>, List<&1, Call(A)>) -> @m:Matches -> Dec(A)

def route source · line 4691 · raw

@-A:Type -> @m:Matches -> @table:List<&1, Pair(String, Call(A))> -> Dec(A)

def sample_typed source · line 4696 · raw

@found:Maybe<&2, ValueType> -> String

def sample_choice source · line 4704 · raw

@found:Maybe<&2, List<&2, String>> -> @attrs:List<&2, Item> -> String

def sample_value source · line 4710 · raw

@kind:UsageKind -> @+attrs:List<&2, Item> -> String

def sample_field source · line 4717 · raw

@build:FieldBuild -> @info:ArgInfo -> List<&2, Field>

def sample_args source · line 4727 · raw

@items:List<&2, Item> -> List<&2, Field>

Each arg in scope: its default as parse resolves it, else a sample value.

def sample_fields source · line 4737 · raw

@c:Cmd -> @path:List<&2, String> -> List<&2, Field>

def sample source · line 4741 · raw

@+c:Cmd -> @+path:List<&2, String> -> Matches

def sub_paths source · line 4745 · raw

@items:List<&2, Item> -> @+prefix:List<&2, String> -> List<&2, List<&2, String>>

The paths below prefix that can complete, in pre-order, without built-ins.

def sample_paths source · line 4759 · raw

@c:Cmd -> List<&2, List<&2, String>>

def decode_bug source · line 4766 · raw

@-A:Type -> @d:Dec(A) -> @at:String -> List<&2, Problem>

def cmd_name source · line 4771 · raw

@c:Cmd -> String

def host_tty source · line 4793 · raw

@h:Host -> @out:Bool -> @err:Bool -> Host

def color_attrs source · line 4798 · raw

@attrs:List<&2, Item> -> Bool

Rules 1 and 2 apply only to color() exactly as declared.

def is_color source · line 4805 · raw

@item:Item -> Bool

def has_color source · line 4812 · raw

@items:List<&2, Item> -> Bool

def color_seek source · line 4824 · raw

@dash:Bool -> @bare:Bool -> @attached:Bool -> @token:String -> @last:Maybe<&2, String> -> Prescan

def color_want source · line 4832 · raw

@hyphen:Bool -> @+token:String -> Prescan

def color_step source · line 4839 · raw

@state:Prescan -> @+token:String -> Prescan

def color_scan source · line 4847 · raw

@argv:List<&2, String> -> @state:Prescan -> Prescan

def color_word source · line 4852 · raw

@always:Bool -> @never:Bool -> Maybe<&2, Bool>

def color_value source · line 4858 · raw

@found:Maybe<&2, String> -> Maybe<&2, Bool>

def color_pick source · line 4864 · raw

@state:Prescan -> Maybe<&2, Bool>

def color_flag source · line 4870 · raw

@enabled:Bool -> @argv:List<&2, String> -> Maybe<&2, Bool>

def var_set source · line 4876 · raw

@found:Maybe<&2, String> -> Bool

An empty variable counts as unset.

def var_is source · line 4881 · raw

@found:Maybe<&2, String> -> @text:String -> Bool

def force_set source · line 4886 · raw

@found:Maybe<&2, String> -> Bool

def env_off source · line 4893 · raw

@off:Bool -> Maybe<&2, Bool>

def env_force source · line 4898 · raw

@force:Bool -> @+vars:List<&2, Var> -> Maybe<&2, Bool>

def env_rules source · line 4905 · raw

@no_color:Bool -> @+vars:List<&2, Var> -> Maybe<&2, Bool>

def env_color source · line 4912 · raw

@+vars:List<&2, Var> -> Maybe<&2, Bool>

Rules 3-6; None leaves rule 7, each stream's TTY.

def term_env source · line 4915 · raw

@found:Maybe<&2, Bool> -> @out_tty:Bool -> @err_tty:Bool -> @width:Nat -> Term

def term_for source · line 4921 · raw

@flag:Maybe<&2, Bool> -> @vars:List<&2, Var> -> @out_tty:Bool -> @err_tty:Bool -> @width:Nat -> Term

def term source · line 4927 · raw

@c:Cmd -> @h:Host -> @argv:List<&2, String> -> Term

def plain source · line 4935 · raw

@text:String -> Segment

def page_width source · line 4938 · raw

@width:Nat -> Nat

def summary source · line 4942 · raw

@s:String -> String

The first paragraph: the text before the first blank line.

def shown_text source · line 4948 · raw

@long:Bool -> @text:String -> String

def filled source · line 4953 · raw

@s:String -> Bool

def join_filled source · line 4956 · raw

@parts:List<&2, String> -> String

def find_command source · line 4965 · raw

@items:List<&2, Item> -> @+query:String -> @found:Maybe<&2, Item> -> Maybe<&2, Item>

def view_enter source · line 4977 · raw

@found:Maybe<&2, Item> -> @path:String -> @about:String -> @items:List<&2, Item> -> @globals:List<&2, Item> -> @root:Bool -> View

def view_step source · line 4985 · raw

@view:View -> @step:String -> View

def view_walk source · line 4993 · raw

@steps:List<&2, String> -> @view:View -> View

def view_of source · line 4998 · raw

@c:Cmd -> @path:List<&2, String> -> View

def arg_pos source · line 5003 · raw

@usage:String -> Bool

def has_plain_option source · line 5006 · raw

@items:List<&2, Item> -> Bool

def required_elem source · line 5015 · raw

@required:Bool -> @usage:String -> @attrs:List<&2, Item> -> List<&2, Segment>

def required_options source · line 5021 · raw

@items:List<&2, Item> -> List<&2, Segment>

def group_elem source · line 5031 · raw

@listed:Bool -> @args:List<&2, Item> -> @group:String -> List<&2, Segment>

def group_elems source · line 5038 · raw

@items:List<&2, Item> -> @+args:List<&2, Item> -> @+done:List<&2, String> -> List<&2, Segment>

Each need_one group of items, over args, that done does not name yet.

def positional_elems source · line 5049 · raw

@items:List<&2, Item> -> List<&2, Segment>

def command_elems source · line 5057 · raw

@subs:Bool -> @need:Bool -> List<&2, Segment>

def options_elem source · line 5063 · raw

@present:Bool -> List<&2, Segment>

def usage_elems source · line 5070 · raw

@path:String -> @+items:List<&2, Item> -> @+globals:List<&2, Item> -> List<&2, Segment>

The path, [OPTIONS], required options, need_one groups as E06 writes them, positionals, then the subcommand slot.

def segment_texts source · line 5083 · raw

@segs:List<&2, Segment> -> List<&2, String>

def usage_view source · line 5088 · raw

@view:View -> String

def usage source · line 5093 · raw

@c:Cmd -> @path:List<&2, String> -> String

def usage_rest source · line 5097 · raw

@elems:List<&2, Segment> -> @+w:Nat -> @+col:Nat -> List<&2, Segment>

Usage wraps between elements and continues at column 7.

def usage_block source · line 5108 · raw

@elems:List<&2, Segment> -> @w:Nat -> List<&2, Segment>

def tag source · line 5123 · raw

@name:String -> @values:List<&2, String> -> String

def maybe_list source · line 5129 · raw

@found:Maybe<&2, String> -> List<&2, String>

def list_or_none source · line 5134 · raw

@found:Maybe<&2, List<&2, String>> -> List<&2, String>

def right_text source · line 5139 · raw

@long:Bool -> @help:String -> @+attrs:List<&2, Item> -> String

def bold_names source · line 5148 · raw

@names:List<&2, String> -> @first:Bool -> List<&2, Segment>

def value_cut source · line 5157 · raw

@s:String -> Nat

Where an option's value or repeat starts: " <", "[=", or a final "...".

def option_left source · line 5166 · raw

@+usage:String -> List<&2, Segment>

Option names bold; separators, value and repeat plain.

def arg_row source · line 5172 · raw

@parsed:Usage -> @usage:String -> @help:String -> @attrs:List<&2, Item> -> @long:Bool -> Row

def find_heading source · line 5181 · raw

@attrs:List<&2, Item> -> String

def option_row source · line 5187 · raw

@shown:Bool -> @+usage:String -> @help:String -> @attrs:List<&2, Item> -> @long:Bool -> List<&2, Row>

def option_rows source · line 5194 · raw

@items:List<&2, Item> -> @+long:Bool -> @+heading:String -> List<&2, Row>

The visible options under a heading, "" for Options.

def positional_row source · line 5207 · raw

@shown:Bool -> @usage:String -> @help:String -> @attrs:List<&2, Item> -> @long:Bool -> List<&2, Row>

def positional_rows source · line 5214 · raw

@items:List<&2, Item> -> @+long:Bool -> List<&2, Row>

def command_row source · line 5224 · raw

@hidden:Bool -> @name:String -> @about:String -> @children:List<&2, Item> -> List<&2, Row>

def command_rows source · line 5232 · raw

@items:List<&2, Item> -> List<&2, Row>

def help_sub_row source · line 5241 · raw

@present:Bool -> List<&2, Row>

def builtin_row source · line 5249 · raw

@taken:Bool -> @short:String -> @long:String -> @text:String -> Row

A built-in option row, without its short when an app arg took it.

def help_text source · line 5256 · raw

@differs:Bool -> @long:Bool -> String

def version_row source · line 5262 · raw

@present:Bool -> @args:List<&2, Item> -> List<&2, Row>

def heading_titles source · line 5270 · raw

@items:List<&2, Item> -> @+seen:List<&2, String> -> List<&2, String>

Headings of visible args, in order of first use.

def heading_sections source · line 5282 · raw

@titles:List<&2, String> -> @+args:List<&2, Item> -> @+long:Bool -> List<&2, Section>

def args_paragraphs source · line 5291 · raw

@items:List<&2, Item> -> Bool

Whether a visible arg's help has more than one paragraph.

def indent_cell source · line 5299 · raw

@indent:Bool -> @left:List<&2, Segment> -> List<&2, Segment>

def row_cell source · line 5305 · raw

@row:Row -> @shorted:Bool -> List<&2, Segment>

A left cell; long-only options indent 4 more on a page with a short.

def cell_width source · line 5310 · raw

@cell:List<&2, Segment> -> Nat

def row_short source · line 5315 · raw

@row:Row -> Bool

def any_short source · line 5319 · raw

@rows:List<&2, Row> -> Bool

def widest source · line 5325 · raw

@rows:List<&2, Row> -> @+shorted:Bool -> @+k:Nat -> @+best:Nat -> Nat

L, the widest left cell w with 2 + w + 2 <= K.

def pad_line source · line 5333 · raw

@line:String -> @col:Nat -> String

def pad_lines source · line 5339 · raw

@lines:List<&2, String> -> @+col:Nat -> List<&2, Segment>

def first_then source · line 5344 · raw

@lines:List<&2, String> -> @col:Nat -> List<&2, Segment>

def row_form source · line 5351 · raw

@fits:Bool -> @cell:List<&2, Segment> -> @lw:Nat -> @right:String -> @w:Nat -> @+c:Nat -> List<&2, Segment>

A cell that fits takes its text after padding to C; one that does not stands alone, its text on the next lines at max(C, 10).

def row_lines source · line 5363 · raw

@row:Row -> @shorted:Bool -> @w:Nat -> @k:Nat -> @c:Nat -> List<&2, Segment>

def rows_lines source · line 5371 · raw

@rows:List<&2, Row> -> @+shorted:Bool -> @+w:Nat -> @+k:Nat -> @+c:Nat -> List<&2, Segment>

def section_rows source · line 5379 · raw

@sections:List<&2, Section> -> List<&2, Row>

def section_blocks source · line 5385 · raw

@sections:List<&2, Section> -> @+shorted:Bool -> @+w:Nat -> @+k:Nat -> @+c:Nat -> List<&2, List<&2, Segment>>

def sections_blocks source · line 5396 · raw

@+sections:List<&2, Section> -> @+w:Nat -> List<&2, List<&2, Segment>>

One column for the page: C = L + 4, with K = 2W/5.

def text_block source · line 5404 · raw

@text:String -> @w:Nat -> List<&2, List<&2, Segment>>

def example_lines source · line 5409 · raw

@items:List<&2, Item> -> List<&2, Segment>

def examples_block source · line 5417 · raw

@lines:List<&2, Segment> -> List<&2, List<&2, Segment>>

def after_texts source · line 5422 · raw

@items:List<&2, Item> -> List<&2, String>

def more_blocks source · line 5428 · raw

@blocks:List<&2, List<&2, Segment>> -> List<&2, Segment>

def join_blocks source · line 5435 · raw

@blocks:List<&2, List<&2, Segment>> -> List<&2, Segment>

Blocks apart by one blank line; the page ends with a newline.

def help_page source · line 5440 · raw

@view:View -> @+long:Bool -> @+w:Nat -> List<&2, Segment>

def help_out source · line 5463 · raw

@t:Term -> @view:View -> @long:Bool -> String

def help source · line 5469 · raw

@+c:Cmd -> @path:List<&2, String> -> @long:Bool -> @h:Host -> String

The help page for the longest valid prefix of path, in stdout's colors.

def row_zero source · line 5477 · raw

@b:String -> @+k:Nat -> List<&2, Nat>

def head_nat source · line 5482 · raw

@xs:List<&2, Nat> -> Nat

def tail_nats source · line 5487 · raw

@xs:List<&2, Nat> -> List<&2, Nat>

def same_char source · line 5492 · raw

@found:Maybe<&2, Char> -> @c:Char -> Bool

def osa_row source · line 5499 · raw

@bs:String -> @bp:Maybe<&2, Char> -> @+a:Char -> @+ap:Maybe<&2, Char> -> @+up:List<&2, Nat> -> @+up2:List<&2, Nat> -> @left:Nat -> List<&2, Nat>

Row i of optimal string alignment for a[i]: up starts at d[i-1][j-1], up2 at d[i-2][j-2], and left is d[i][j-1].

def osa_rows source · line 5513 · raw

@s:String -> @ap:Maybe<&2, Char> -> @+i:Nat -> @+b:String -> @+prev:List<&2, Nat> -> @prev2:List<&2, Nat> -> List<&2, Nat>

def last_nat source · line 5521 · raw

@xs:List<&2, Nat> -> @last:Nat -> Nat

def osa source · line 5526 · raw

@a:String -> @+b:String -> Nat

def undashed source · line 5530 · raw

@s:String -> String

def scored source · line 5535 · raw

@names:List<&2, String> -> @+typed:String -> @+limit:Nat -> List<&2, Scored>

def at_distance source · line 5545 · raw

@found:List<&2, Scored> -> @+d:Nat -> List<&2, String>

def by_distance source · line 5552 · raw

@levels:Nat -> @+d:Nat -> @+found:List<&2, Scored> -> List<&2, String>

def suggest source · line 5564 · raw

@+typed:String -> @names:List<&2, String> -> List<&2, String>

At most 3 names within max(1, n / 3) edits, by distance, then order. key is bound because a temporary argument makes String.length take its string, adding a keep to each caller that reuses one (Nat.read.fits, arg_display).

def quoted source · line 5572 · raw

@text:String -> @styles:List<&2, Style> -> List<&2, Segment>

def missing_lines source · line 5575 · raw

@missing:List<&2, String> -> String

def visible_subs source · line 5580 · raw

@items:List<&2, Item> -> List<&2, String>

def fault_message source · line 5588 · raw

@fault:ScanFault -> @path:String -> @items:List<&2, Item> -> List<&2, Segment>

def green_names source · line 5630 · raw

@names:List<&2, String> -> @first:Bool -> List<&2, Segment>

def tip source · line 5638 · raw

@text:String -> List<&2, List<&2, Segment>>

def similar source · line 5642 · raw

@kind:String -> @found:List<&2, String> -> List<&2, List<&2, Segment>>

T4: one suggestion or several.

def long_name source · line 5653 · raw

@s:String -> Bool

def option_names source · line 5656 · raw

@parsed:Usage -> @attrs:List<&2, Item> -> List<&2, String>

def visible_names source · line 5668 · raw

@hidden:Bool -> @usage:String -> @attrs:List<&2, Item> -> List<&2, String>

def long_candidates source · line 5675 · raw

@items:List<&2, Item> -> List<&2, String>

T4 for E01: visible longs, their no- forms and long aliases.

def sub_candidates source · line 5684 · raw

@items:List<&2, Item> -> List<&2, String>

T4 for E02: visible subcommand names and aliases, then help.

def display_choices source · line 5695 · raw

@items:List<&2, Item> -> @+arg:String -> @found:List<&2, String> -> List<&2, String>

T4 for E04: the one_of values of the arg E04 names.

def owned source · line 5706 · raw

@found:Maybe<&2, OptFound> -> @text:String -> Maybe<&2, String>

def owned_by source · line 5711 · raw

@hit:Maybe<&2, OptFound> -> @token:String -> @prefix:String -> @step:String -> @found:Maybe<&2, String> -> Maybe<&2, String>

def owner source · line 5720 · raw

@path:List<&2, String> -> @+items:List<&2, Item> -> @+prefix:String -> @+token:String -> @+long:String -> @found:Maybe<&2, String> -> Maybe<&2, String>

T1: the deepest ancestor whose args take the long, and its child on path.

def descendant source · line 5731 · raw

@items:List<&2, Item> -> @+prefix:String -> @+long:String -> @found:Maybe<&2, String> -> Maybe<&2, String>

T2: the first subcommand in pre-order whose args take the long.

def maybe_tip source · line 5742 · raw

@found:Maybe<&2, String> -> List<&2, List<&2, Segment>>

def belongs source · line 5747 · raw

@found:Maybe<&2, String> -> @token:String -> List<&2, List<&2, Segment>>

def sub_exists source · line 5754 · raw

@found:Maybe<&2, SubFound> -> @name:String -> List<&2, List<&2, Segment>>

def before_eq source · line 5762 · raw

@s:String -> String

def long_tips source · line 5769 · raw

@is_long:Bool -> @+token:String -> @root:String -> @path:List<&2, String> -> @+items:List<&2, Item> -> @root_items:List<&2, Item> -> @here:String -> List<&2, List<&2, Segment>>

T1, T2 and T3, for E01 on a long; --name=value looks up --name.

def operand_count source · line 5784 · raw

@events:List<&2, ScanEvent> -> @count:Nat -> Nat

def trace_operands source · line 5791 · raw

@trace:ScanTrace -> Nat

def dash_slot source · line 5796 · raw

@open:Bool -> @+token:String -> List<&2, List<&2, Segment>>

def dash_tip source · line 5805 · raw

@hyphen:Bool -> @token:String -> @items:List<&2, Item> -> @c:Cmd -> @argv:List<&2, String> -> List<&2, List<&2, Segment>>

T5: a hyphen token that the next positional slot could take after --; only then is argv scanned again to count the operands in scope.

def cmd_items source · line 5813 · raw

@c:Cmd -> List<&2, Item>

def fault_tips source · line 5818 · raw

@fault:ScanFault -> @+c:Cmd -> @+path:List<&2, String> -> @argv:List<&2, String> -> @here:String -> @+items:List<&2, Item> -> @globals:List<&2, Item> -> List<&2, List<&2, Segment>>

Every tip that applies, in table order.

def tip_spans source · line 5842 · raw

@tips:List<&2, List<&2, Segment>> -> List<&2, Segment>

def tip_block source · line 5850 · raw

@tips:List<&2, List<&2, Segment>> -> List<&2, Segment>

def error_page source · line 5855 · raw

@message:List<&2, Segment> -> @tips:List<&2, List<&2, Segment>> -> @usage:List<&2, Segment> -> List<&2, Segment>

def fault_view source · line 5865 · raw

@view:View -> @+fault:ScanFault -> @c:Cmd -> @path:List<&2, String> -> @argv:List<&2, String> -> @w:Nat -> List<&2, Segment>

def fault_err source · line 5874 · raw

@t:Term -> @fault:ScanFault -> @+c:Cmd -> @+path:List<&2, String> -> @argv:List<&2, String> -> String

An error at the scope where scanning stopped, in stderr's colors.

def summary_err source · line 5881 · raw

@t:Term -> @view:View -> String

def problem_line source · line 5888 · raw

@p:Problem -> String

def problem_lines source · line 5925 · raw

@found:List<&2, Problem> -> String

def sh_body source · line 5937 · raw

@s:String -> String

def Sh.quote source · line 5944 · raw

@s:String -> String

POSIX single quotes, with ' written as '\'' (P3).

def fish_body source · line 5947 · raw

@s:String -> String

def Fish.quote source · line 5955 · raw

@s:String -> String

fish single quotes, with \ and ' backslash-escaped (P4).

def Zsh.esc source · line 5960 · raw

@s:String -> String

Text in an _arguments spec or a _describe entry, with \, [, ] and : backslash-escaped (P5).

def roff_body source · line 5971 · raw

@s:String -> @start:Bool -> String

Text for man(7), start telling whether a line starts here: \, -, ", ' and ` as escapes, and \& before a . or a space that starts a line.

def Roff.esc source · line 5985 · raw

@s:String -> String

Text that starts lines (P6, P15).

def roff_text source · line 5989 · raw

@s:String -> String

Text after the start of a line.

def text_lines source · line 5992 · raw

@lines:List<&2, String> -> String

def one_line source · line 5998 · raw

@s:String -> String

The summary with its hard line breaks as spaces.

def ident_char source · line 6001 · raw

@+c:Char -> Char

def ident source · line 6005 · raw

@s:String -> String

A name with every char outside [A-Za-z0-9_] as _, for shell identifiers.

def same_words source · line 6010 · raw

@a:List<&2, String> -> @b:List<&2, String> -> Bool

def last_with source · line 6016 · raw

@lines:List<&2, String> -> @+suffix:String -> List<&2, String>

def places source · line 6029 · raw

@items:List<&2, Item> -> @+words:List<&2, String> -> @+globals:List<&2, Item> -> List<&2, Place>

The visible commands below items, whose subcommands inherit globals.

def all_places source · line 6042 · raw

@+items:List<&2, Item> -> List<&2, Place>

def list_number source · line 6069 · raw

@lists:List<&2, List<&2, String>> -> @+values:List<&2, String> -> @hit:Bool -> @+k:Nat -> Nat

The number of values in lists, counting from k + 1 after a miss, or 0.

def add_list source · line 6077 · raw

@found:Maybe<&2, List<&2, String>> -> @+lists:List<&2, List<&2, String>> -> List<&2, List<&2, String>>

def visible_one_of source · line 6086 · raw

@hidden:Bool -> @attrs:List<&2, Item> -> Maybe<&2, List<&2, String>>

def item_lists source · line 6092 · raw

@items:List<&2, Item> -> @lists:List<&2, List<&2, String>> -> List<&2, List<&2, String>>

def place_lists source · line 6101 · raw

@places:List<&2, Place> -> @lists:List<&2, List<&2, String>> -> List<&2, List<&2, String>>

The one_of lists of visible args, each once, in pre-order.

def type_comp source · line 6108 · raw

@found:Maybe<&2, ValueType> -> Comp

def comp_of source · line 6114 · raw

@found:Maybe<&2, List<&2, String>> -> @t:Maybe<&2, ValueType> -> @lists:List<&2, List<&2, String>> -> Comp

def head_part source · line 6120 · raw

@parts:List<&2, String> -> String

def next_part source · line 6125 · raw

@parts:List<&2, String> -> String

def between source · line 6130 · raw

@s:String -> @+open:Char -> @close:Char -> String

def placeholder source · line 6134 · raw

@+usage:String -> String

The name in a usage's <>, or in an optional positional's [].

def short_alias source · line 6138 · raw

@s:String -> Bool

def short_names source · line 6141 · raw

@parsed:Usage -> @attrs:List<&2, Item> -> List<&2, String>

def parsed_kind source · line 6149 · raw

@parsed:Usage -> UsageKind

def arg_opt source · line 6154 · raw

@+parsed:Usage -> @usage:String -> @help:String -> @+attrs:List<&2, Item> -> @lists:List<&2, List<&2, String>> -> Opt

def arg_opts source · line 6162 · raw

@items:List<&2, Item> -> @+lists:List<&2, List<&2, String>> -> List<&2, Opt>

The visible options in items.

def flag_opt source · line 6174 · raw

@names:List<&2, String> -> @help:String -> Opt

def version_opts source · line 6177 · raw

@present:Bool -> @args:List<&2, Item> -> List<&2, Opt>

def builtin_opts source · line 6187 · raw

@+items:List<&2, Item> -> @globals:List<&2, Item> -> @root:Bool -> List<&2, Opt>

-h and --help, without -h when an arg took it, then at a root with a version -V and --version likewise.

def pos_slot source · line 6195 · raw

@parsed:Usage -> @k:Nat -> @usage:String -> @+attrs:List<&2, Item> -> @lists:List<&2, List<&2, String>> -> List<&2, Slot>

def arg_slots source · line 6204 · raw

@items:List<&2, Item> -> @+k:Nat -> @+lists:List<&2, List<&2, String>> -> List<&2, Slot>

The positional slots in items, hidden ones too, numbered from k.

def completing source · line 6216 · raw

@slots:List<&2, Slot> -> List<&2, Slot>

The slots up to the variadic one, which takes every later value.

def variadic source · line 6223 · raw

@slots:List<&2, Slot> -> Maybe<&2, Slot>

def sub_entries source · line 6231 · raw

@items:List<&2, Item> -> List<&2, Entry>

The visible subcommands in items.

def opt_names source · line 6240 · raw

@opts:List<&2, Opt> -> List<&2, String>

def entry_names source · line 6246 · raw

@entries:List<&2, Entry> -> List<&2, String>

def stop_of source · line 6258 · raw

@place:Place -> @k:Nat -> @+lists:List<&2, List<&2, String>> -> Stop

def stops source · line 6267 · raw

@places:List<&2, Place> -> @+k:Nat -> @+lists:List<&2, List<&2, String>> -> List<&2, Stop>

def stop_number source · line 6275 · raw

@stops:List<&2, Stop> -> @+words:List<&2, String> -> @found:Maybe<&2, Nat> -> Nat

The number of the stop at words, from found on.

def sh_list source · line 6287 · raw

@words:List<&2, String> -> @+sep:String -> String

Words quoted for sh, apart by sep.

def dests source · line 6293 · raw

@names:List<&2, String> -> @+dest:String -> List<&2, String>

def entry_dests source · line 6299 · raw

@entries:List<&2, Entry> -> @+words:List<&2, String> -> List<&2, String>

Each subcommand name's path, once per name.

def bash_subs source · line 6308 · raw

@+entries:List<&2, Entry> -> @words:List<&2, String> -> List<&2, String>

def bash_shape source · line 6316 · raw

@found:Maybe<&2, Slot> -> List<&2, String>

def bash_scope_arm source · line 6323 · raw

@stop:Stop -> List<&2, String>

def bash_letter source · line 6334 · raw

@comp:Comp -> String

def bash_values source · line 6341 · raw

@comp:Comp -> String

def bash_kind source · line 6346 · raw

@+comp:Comp -> @bare:Bool -> String

def bash_opt_case source · line 6350 · raw

@opt:Opt -> List<&2, String>

def bash_opt_cases source · line 6360 · raw

@opts:List<&2, Opt> -> List<&2, String>

def bash_slot_cases source · line 6365 · raw

@slots:List<&2, Slot> -> List<&2, String>

def bash_cases source · line 6377 · raw

@words:List<&2, String> -> @cases:List<&2, String> -> List<&2, String>

def bash_arg_arm source · line 6389 · raw

@stop:Stop -> List<&2, String>

def bash_engine source · line 6402 · raw

@+id:String -> @name:String -> List<&2, String>

The rest of every bash script, for function prefix id and the quoted command name: the parser of COMP_WORDS, then the binding.

def bash_script source · line 6510 · raw

@+name:String -> @+items:List<&2, Item> -> String

def zsh_action source · line 6541 · raw

@comp:Comp -> String

def zsh_pre source · line 6550 · raw

@kind:UsageKind -> @+names:List<&2, String> -> String

The prefix of an option's specs: * when it repeats, else its names as a group that excludes each other.

def zsh_spec source · line 6558 · raw

@+name:String -> @kind:UsageKind -> @pre:String -> @d:String -> @ph:String -> @act:String -> String

def zsh_names source · line 6568 · raw

@names:List<&2, String> -> @+kind:UsageKind -> @+pre:String -> @+d:String -> @+ph:String -> @+act:String -> List<&2, String>

def zsh_opts source · line 6576 · raw

@opts:List<&2, Opt> -> List<&2, String>

def zsh_slots source · line 6585 · raw

@slots:List<&2, Slot> -> List<&2, String>

def zsh_spec_lines source · line 6599 · raw

@specs:List<&2, String> -> @+ind:String -> List<&2, String>

Specs quoted, one per line, all but the last continued.

def zsh_args source · line 6608 · raw

@+ind:String -> @specs:List<&2, String> -> List<&2, String>

def zsh_entry source · line 6611 · raw

@names:List<&2, String> -> @+ind:String -> @+about:String -> List<&2, String>

def zsh_entries source · line 6619 · raw

@entries:List<&2, Entry> -> @+ind:String -> List<&2, String>

def zsh_commands source · line 6626 · raw

@entries:List<&2, Entry> -> @with_help:Bool -> @label:String -> @+ind:String -> List<&2, String>

def zsh_label source · line 6639 · raw

@+name:String -> @words:List<&2, String> -> String

def zsh_deeper source · line 6642 · raw

@arms:List<&2, String> -> @+depth:Nat -> @+ind:String -> List<&2, String>

def zsh_help_tree source · line 6655 · raw

@entries:List<&2, Entry> -> @label:String -> @arms:List<&2, String> -> @+depth:Nat -> @+ind:String -> List<&2, String>

After help at depth, the subcommand names, then deeper by arms.

def bar_names source · line 6664 · raw

@names:List<&2, String> -> String

def zsh_help_arms source · line 6672 · raw

@items:List<&2, Item> -> @+name:String -> @+words:List<&2, String> -> @+depth:Nat -> @+ind:String -> List<&2, String>

The help tree's arms at ind for the subcommands in items that have subcommands of their own.

def zsh_past_end source · line 6692 · raw

@ind:String -> String

Ends a state that _arguments entered past a "--" it dropped, after which no subcommand follows.

def zsh_ends source · line 6697 · raw

@words:List<&2, String> -> @+ind:String -> List<&2, String>

At the top command (no words), the count of "--" before the cursor that zsh_past_end compares with.

def zsh_branch source · line 6709 · raw

@+entries:List<&2, Entry> -> @specs:List<&2, String> -> @+items:List<&2, Item> -> @+name:String -> @+words:List<&2, String> -> @arms:List<&2, String> -> @+ind:String -> List<&2, String>

The body of a command with subcommands: its specs end in a state that offers them, completes help's tree, or enters the arm of the one given.

def zsh_body source · line 6742 · raw

@entries:List<&2, Entry> -> @specs:List<&2, String> -> @+items:List<&2, Item> -> @+lists:List<&2, List<&2, String>> -> @name:String -> @words:List<&2, String> -> @arms:List<&2, String> -> @ind:String -> List<&2, String>

def zsh_cmd source · line 6755 · raw

@+items:List<&2, Item> -> @+globals:List<&2, Item> -> @+lists:List<&2, List<&2, String>> -> @name:String -> @+words:List<&2, String> -> @arms:List<&2, String> -> @ind:String -> List<&2, String>

The body at ind of the command with items and globals at words, given the arms of its subcommands.

def zsh_arms source · line 6769 · raw

@items:List<&2, Item> -> @+globals:List<&2, Item> -> @+lists:List<&2, List<&2, String>> -> @+name:String -> @+words:List<&2, String> -> @+ind:String -> List<&2, String>

The arms at ind for the visible subcommands in items, which inherit globals; their bodies are 2 deeper.

def zsh_lists source · line 6787 · raw

@lists:List<&2, List<&2, String>> -> @+k:Nat -> List<&2, String>

def zsh_arrays source · line 6795 · raw

@lists:List<&2, List<&2, String>> -> List<&2, String>

def zsh_script source · line 6802 · raw

@+name:String -> @+items:List<&2, Item> -> String

def fish_list source · line 6825 · raw

@words:List<&2, String> -> String

Words quoted for fish, apart by spaces.

def fish_pats source · line 6831 · raw

@names:List<&2, String> -> @+pre:String -> List<&2, String>

def fish_dest_arms source · line 6838 · raw

@entries:List<&2, Entry> -> @+pre:String -> @+words:List<&2, String> -> @+found:List<&2, Stop> -> List<&2, String>

The arms of _dest for subcommands entries of the path at words, numbered pre.

def fish_dests source · line 6848 · raw

@stops:List<&2, Stop> -> @+found:List<&2, Stop> -> List<&2, String>

def valued_names source · line 6857 · raw

@opts:List<&2, Opt> -> List<&2, String>

def fish_valued_arm source · line 6864 · raw

@k:Nat -> @names:List<&2, String> -> List<&2, String>

def fish_valued source · line 6872 · raw

@stop:Stop -> List<&2, String>

def slot_shape source · line 6877 · raw

@found:Maybe<&2, Slot> -> String

def fish_shape_arm source · line 6883 · raw

@shown:Bool -> @k:Nat -> @has:Bool -> @found:Maybe<&2, Slot> -> List<&2, String>

def fish_shape source · line 6892 · raw

@stop:Stop -> List<&2, String>

def fish_values source · line 6900 · raw

@lists:List<&2, List<&2, String>> -> @+k:Nat -> List<&2, String>

def fish_values_fn source · line 6909 · raw

@+id:String -> @lists:List<&2, List<&2, String>> -> List<&2, String>

def fish_flag source · line 6921 · raw

@long:Bool -> @name:String -> String

def fish_flags source · line 6926 · raw

@names:List<&2, String> -> List<&2, String>

def fish_words source · line 6932 · raw

@+id:String -> @comp:Comp -> String

What completes a value comp offers: words, files, directories or none.

def fish_needs source · line 6940 · raw

@comp:Comp -> String

def fish_kind source · line 6947 · raw

@kind:UsageKind -> @+id:String -> @+comp:Comp -> String

An option of kind needs its value (-r), and only a file name may be any word (-x elsewhere); a [=<V>] value is optional.

def fish_opt_lines source · line 6954 · raw

@opts:List<&2, Opt> -> @+at:String -> @+id:String -> List<&2, String>

def fish_builtin_lines source · line 6964 · raw

@opts:List<&2, Opt> -> @+at:String -> @tags:String -> List<&2, String>

The built-ins, help first, which also holds after help (h).

def fish_name_lines source · line 6972 · raw

@names:List<&2, String> -> @+at:String -> @+about:String -> List<&2, String>

def fish_sub_lines source · line 6980 · raw

@entries:List<&2, Entry> -> @+at:String -> List<&2, String>

def fish_slot_lines source · line 6987 · raw

@slots:List<&2, Slot> -> @+at:String -> @+id:String -> List<&2, String>

def fish_ends source · line 6999 · raw

@subs:List<&2, Entry> -> @+at:String -> @id:String -> @slots:List<&2, Slot> -> List<&2, String>

def fish_lines source · line 7007 · raw

@stops:List<&2, Stop> -> @+pre:String -> @+id:String -> List<&2, String>

def fish_engine source · line 7022 · raw

@+id:String -> List<&2, String>

The function every fish script shares, for function prefix id: it walks the words before the cursor as the bash engine does.

def fish_script source · line 7091 · raw

@+name:String -> @+items:List<&2, Item> -> String

def roff_bold source · line 7130 · raw

@s:String -> String

def roff_bolds source · line 7133 · raw

@names:List<&2, String> -> List<&2, String>

def roff_texts source · line 7138 · raw

@texts:List<&2, String> -> List<&2, String>

def spaces_only source · line 7143 · raw

@s:String -> Bool

def line_mark source · line 7149 · raw

@blank:Bool -> @line:String -> List<&2, Maybe<&2, String>>

def para_marks source · line 7156 · raw

@lines:List<&2, String> -> List<&2, Maybe<&2, String>>

Each line, None for an empty one, which ends a paragraph; a line of only spaces is left out.

def roff_marks source · line 7166 · raw

@marks:List<&2, Maybe<&2, String>> -> @+sep:String -> @gap:Maybe<&2, String> -> List<&2, String>

Marked lines escaped, after gap: nothing before the first, .br within a paragraph, sep between paragraphs.

def roff_paras source · line 7177 · raw

@text:String -> @sep:String -> List<&2, String>

def ph_end source · line 7180 · raw

@s:String -> Nat

def roff_ph source · line 7187 · raw

@+s:String -> String

A placeholder's name in italics, from after its <.

def roff_value source · line 7192 · raw

@rest:String -> String

def roff_option source · line 7201 · raw

@+usage:String -> String

Option names bold, the placeholder in italics.

def roff_positional source · line 7207 · raw

@+usage:String -> String

A positional in italics, apart from its repeat.

def roff_entry source · line 7212 · raw

@left:String -> @help:String -> @attrs:List<&2, Item> -> List<&2, String>

def roff_positional_entry source · line 7216 · raw

@shown:Bool -> @usage:String -> @help:String -> @attrs:List<&2, Item> -> List<&2, String>

def roff_positionals source · line 7222 · raw

@items:List<&2, Item> -> List<&2, String>

def roff_option_entry source · line 7232 · raw

@shown:Bool -> @usage:String -> @help:String -> @attrs:List<&2, Item> -> List<&2, String>

def roff_options source · line 7239 · raw

@items:List<&2, Item> -> @+heading:String -> List<&2, String>

The visible options under a heading, "" for OPTIONS.

def roff_builtins source · line 7250 · raw

@opts:List<&2, Opt> -> List<&2, String>

def roff_headings source · line 7257 · raw

@titles:List<&2, String> -> @+args:List<&2, Item> -> List<&2, String>

def roff_command source · line 7266 · raw

@hidden:Bool -> @+page:String -> @name:String -> @about:String -> @children:List<&2, Item> -> List<&2, String>

def roff_commands source · line 7275 · raw

@items:List<&2, Item> -> @+page:String -> List<&2, String>

def roff_arg source · line 7284 · raw

@pos:Bool -> @+usage:String -> @attrs:List<&2, Item> -> String

def roff_env_names source · line 7289 · raw

@names:List<&2, String> -> List<&2, String>

def roff_env_order source · line 7295 · raw

@rest:List<&2, String> -> String

How a variable after the first is read, if there is one.

def roff_env source · line 7300 · raw

@hidden:Bool -> @names:List<&2, String> -> @+usage:String -> @attrs:List<&2, Item> -> List<&2, String>

def roff_envs source · line 7309 · raw

@items:List<&2, Item> -> List<&2, String>

def roff_examples source · line 7318 · raw

@items:List<&2, Item> -> @before:List<&2, String> -> List<&2, String>

def sub_pages source · line 7331 · raw

@items:List<&2, Item> -> @+page:String -> List<&2, String>

def init_words source · line 7340 · raw

@words:List<&2, String> -> List<&2, String>

def parent_pages source · line 7347 · raw

@words:List<&2, String> -> List<&2, String>

The parent's page, none at the root.

def roff_refs source · line 7353 · raw

@pages:List<&2, String> -> List<&2, String>

def roff_see source · line 7358 · raw

@pages:List<&2, String> -> List<&2, String>

def roff_synopsis source · line 7363 · raw

@texts:List<&2, String> -> String

def roff_section source · line 7368 · raw

@title:String -> @lines:List<&2, String> -> List<&2, String>

def roff_view source · line 7373 · raw

@view:View -> @title:String -> String

def find_version source · line 7404 · raw

@items:List<&2, Item> -> String

def roff source · line 7411 · raw

@c:Cmd -> @path:List<&2, String> -> String

The man page of the command at the longest valid prefix of path (§11).

def script source · line 7418 · raw

@c:Cmd -> @s:Shell -> String

The completion script for shell s (§11).

def sub_at source · line 7431 · raw

@path:List<&2, String> -> @items:List<&2, Item> -> @found:Maybe<&2, SubFound> -> Maybe<&2, SubFound>

The subcommand at path, from found on.

def builtin_name source · line 7439 · raw

@found:Maybe<&2, SubFound> -> Maybe<&2, String>

def field_values source · line 7445 · raw

@f:Field -> List<&2, String>

def shell_named source · line 7450 · raw

@+name:String -> Shell

The shell completions was given, which one_of limits to these three.

def builtin_page source · line 7454 · raw

@man:Bool -> @c:Cmd -> @fields:List<&2, Field> -> String

def outcome_accepted source · line 7463 · raw

@builtin:Maybe<&2, String> -> @c:Cmd -> @path:List<&2, String> -> @fields:List<&2, Field> -> @external:Maybe<&2, ExternalArgs> -> Outcome

V6: the completions built-in prints its script and man its page, plain; any other path is left to decode.

def outcome_parse source · line 7470 · raw

@result:ParseResult -> @+c:Cmd -> @h:Host -> @+argv:List<&2, String> -> Outcome

def outcome_lint source · line 7486 · raw

@found:List<&2, Problem> -> @+c:Cmd -> @+h:Host -> @+argv:List<&2, String> -> Outcome

def outcome source · line 7496 · raw

@+c:Cmd -> @h:Host -> @argv:List<&2, String> -> Outcome

eval through V6: a lint failure, help, version, the V3 summary, an error or a built-in's output is Shown; Matched is a parse left to decode.

def linted_found source · line 7503 · raw

@found:List<&2, Problem> -> @c:Cmd -> Result<&2, &2, List<&2, Problem>, Linted>

def linted source · line 7510 · raw

@+c:Cmd -> Result<&2, &2, List<&2, Problem>, Linted>

Lint c once: a Linted, or lint's problems in the order problems lists.

def outcome_linted source · line 7514 · raw

@l:Linted -> @+h:Host -> @+argv:List<&2, String> -> Outcome

outcome on a Linted's spec, without the lint.

def usage_err source · line 7526 · raw

@t:Term -> @msg:String -> @view:View -> String

E12: a decoder's Usage message as an error at the matched scope, printed as given, in stderr's colors.

def faulted source · line 7533 · raw

@-A:Type -> @f:Fault -> @+cmd:Cmd -> @path:List<&2, String> -> @h:Host -> @argv:List<&2, String> -> Step<A>

def decoded source · line 7541 · raw

@-A:Type -> @d:Dec(A) -> @cmd:Cmd -> @path:List<&2, String> -> @h:Host -> @argv:List<&2, String> -> Step<A>

V7: Done is Go with term's decisions; a fault exits 70 or 2.

def eval_step source · line 7547 · raw

@-A:Type -> @decode:(@+m:Matches -> Dec(A)) -> @o:Outcome -> @h:Host -> @argv:List<&2, String> -> Step<A>

def eval_with source · line 7556 · raw

@-A:Type -> @decode:(@+m:Matches -> Dec(A)) -> @c:Cmd -> @+h:Host -> @+argv:List<&2, String> -> Step<A>

eval with the decoder as a value, so a law can quantify over decoders.

def eval_linted_with source · line 7567 · raw

@-A:Type -> @decode:(@+m:Matches -> Dec(A)) -> @l:Linted -> @+h:Host -> @+argv:List<&2, String> -> Step<A>

eval_linted with the decoder as a value.

def env_names source · line 7579 · raw

@items:List<&2, Item> -> List<&2, String>

Each arg's env name in pre-order: an arg's own, then its subcommands'.

def distinct source · line 7589 · raw

@names:List<&2, String> -> @kept:List<&2, String> -> List<&2, String>

kept, then each name not yet in it.

def vars source · line 7595 · raw

@c:Cmd -> List<&2, String>

def columns_ok source · line 7604 · raw

@+value:String -> Bool

COLUMNS sets the width when as_nat reads it and it is at least 1. digits is bound because a temporary argument makes String.is_empty take its string, adding a take to each caller that reuses one (valid_nat).

def columns_valid source · line 7608 · raw

@ok:Bool -> @value:String -> Maybe<&2, Nat>

def columns_width source · line 7613 · raw

@found:Maybe<&2, String> -> Maybe<&2, Nat>

def tty_columns source · line 7619 · raw

@out_tty:Bool -> @err_tty:Bool -> @out_cols:U32 -> @err_cols:U32 -> Nat

stdout's columns if it is a TTY, else stderr's if it is one, else 0.

def nonzero source · line 7627 · raw

@first:Nat -> @then:Nat -> Nat

first, unless it is 0.

def width_or source · line 7632 · raw

@found:Maybe<&2, Nat> -> @then:Nat -> Nat

def probe source · line 7639 · raw

@+vars:List<&2, Var> -> @+out_tty:Bool -> @+err_tty:Bool -> @out_cols:U32 -> @err_cols:U32 -> Host

§7.3: the host from Run.host's readings; the width is COLUMNS, else the TTY columns, else 80.

def act_code source · line 7645 · raw

@fits:Bool -> @n:U32 -> Pair(U32, String)

def act_exit source · line 7653 · raw

@+n:U32 -> Pair(U32, String)

§7.2: act's code, or 70 with a stderr line when it exceeds 255.

Templates

template usage_kind source · line 1696 · raw

@-f:(@_:UsageKind -> Bool) -> @parsed:Usage -> Bool

template read_check source · line 4396 · raw

@-T:Data -> @-get:(@_:Field -> T) -> @verdict:Maybe<&2, String> -> @fields:List<&2, Field> -> @id:String -> Dec(T)

Validation first; reading a validated value never fails (§6.5).

template read_with source · line 4402 · raw

@-T:Data -> @-get:(@_:Field -> T) -> @want:Want -> @m:Matches -> @+id:String -> Dec(T)

template get_one source · line 4408 · raw

@-T:Data -> @-conv:(@_:String -> T) -> @f:Field -> T

template get_opt source · line 4413 · raw

@-T:Data -> @-conv:(@_:String -> T) -> @f:Field -> Maybe<&2, T>

template convert_all source · line 4418 · raw

@-T:Data -> @-conv:(@_:String -> T) -> @values:List<&2, String> -> List<&2, T>

template get_many source · line 4424 · raw

@-T:Data -> @-conv:(@_:String -> T) -> @f:Field -> List<&2, T>

template sample_bugs source · line 4775 · raw

@-A:Type -> @-decode:(@+m:Matches -> Dec(A)) -> @paths:List<&2, List<&2, String>> -> @+c:Cmd -> List<&2, Problem>

template check source · line 4784 · raw

@-A:Type -> @-decode:(@+m:Matches -> Dec(A)) -> @+c:Cmd -> List<&2, Problem>

template bash_arms source · line 6395 · raw

@-f:(@_:Stop -> List<&2, String>) -> @stops:List<&2, Stop> -> List<&2, String>

template eval source · line 7562 · raw

@-A:Type -> @-decode:(@+m:Matches -> Dec(A)) -> @c:Cmd -> @h:Host -> @argv:List<&2, String> -> Step<A>

The whole CLI as a function. It must stay a direct forwarding definition: P10 and P11 are proved of eval_with.

template eval_linted source · line 7574 · raw

@-A:Type -> @-decode:(@+m:Matches -> Dec(A)) -> @l:Linted -> @h:Host -> @argv:List<&2, String> -> Step<A>

eval on a Linted, without linting its spec again. It must stay a direct forwarding definition: P16, p10_linted and p11_linted are proved of eval_linted_with.