cli Releases (2): 0.2.0.0 0xa67b4e5d151887b6bff62a913c86b60d indexed https://jend.leeeet.dev/files.txt?path=cli@0.2.0.0 0.1.0.0 0x846aad52831f8111f93a9c322d7de83c unindexed https://jend.leeeet.dev/files.txt?path=cli@0.1.0.0 Definitions (1008, 1 to 100 shown): Cli.Style (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=Style) type Style is Data: Bold{} Dim{} Under{} Red{} Green{} Yellow{} Blue{} Magenta{} Cyan{} Cli.Segment (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=Segment) type Segment is Data: Segment{text: String, styles: List<&2, Style>} Cli.style_code (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=style_code) def style_code(style: Style) -> String: Cli.style_codes_tail (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=style_codes_tail) def style_codes_tail(styles: List<&2, Style>) -> String: Cli.style_codes (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=style_codes) def style_codes(styles: List<&2, Style>) -> String: Cli.paint (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=paint) def paint(on: Bool, styles: List<&2, Style>, text: String) -> String: Cli.emit_go (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=emit_go) def emit_go(segments: List<&2, Segment>, +on: Bool) -> String: Cli.emit (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=emit) def emit(on: Bool, segments: List<&2, Segment>) -> String: Cli.sgr_body_char (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=sgr_body_char) def sgr_body_char(+c: Char) -> Bool: Cli.StripState (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=StripState) type StripState is Data: StripPlain{} StripEsc{} StripBody{pending: String} Cli.strip_go (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=strip_go) def strip_go(s: String, state: StripState) -> String: Cli.strip (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=strip) def strip(s: String) -> String: Cli.CodeRange (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=CodeRange) type CodeRange is Data: CodeRange{lo: U32, hi: U32} Cli.contains_range (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=contains_range) def contains_range(ranges: List<&2, CodeRange>, +code: U32) -> Bool: Cli.unicode_is_wide (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=unicode_is_wide) # 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_wide(code: U32) -> Bool: Cli.unicode_is_zero_mark (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=unicode_is_zero_mark) # 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_zero_mark(code: U32) -> Bool: Cli.unicode_is_pictographic (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=unicode_is_pictographic) # 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_is_pictographic(code: U32) -> Bool: Cli.unicode_takes_tone (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=unicode_takes_tone) # 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_takes_tone(code: U32) -> Bool: Cli.unicode_widens_with_vs16 (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=unicode_widens_with_vs16) # 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 unicode_widens_with_vs16(code: U32) -> Bool: Cli.code_width_by (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=code_width_by) # 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_by(small: Bool, +code: U32) -> Nat: Cli.code_width (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=code_width) def code_width(+code: U32) -> Nat: Cli.CodeClass (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=CodeClass) # 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 CodeClass is Data: PlainCode{} KeycapCode{} PictoCode{} ToneCode{} JoinerCode{} Vs16Code{} Cli.EmojiRun (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=EmojiRun) # 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 EmojiRun is Data: EmojiNone{} EmojiBase{code: U32, narrow: Bool, join: Bool} EmojiJoiner{} EmojiJoined{code: U32} Cli.WidthStep (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=WidthStep) type WidthStep is Data: WidthStep{width: Nat, run: EmojiRun} Cli.keycap_base (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=keycap_base) def keycap_base(+code: U32) -> Bool: Cli.picto_class (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=picto_class) # may: whether code is in 203C-3299 or from 1F000, which hold every # pictograph from 768 on. def picto_class(may: Bool, +code: U32) -> CodeClass: Cli.code_class_by (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=code_class_by) def code_class_by(small: Bool, +code: U32) -> CodeClass: Cli.code_class (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=code_class) def code_class(+code: U32) -> CodeClass: Cli.picto_alone (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=picto_alone) def picto_alone(+wide: Bool, code: U32) -> WidthStep: Cli.picto_step (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=picto_step) # A pictograph after a ZWJ joins the sequence; any other starts an emoji. def picto_step(run: EmojiRun, +code: U32) -> WidthStep: Cli.tone_on (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=tone_on) # 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(takes: Bool, narrow: Bool, join: Bool, code: U32) -> WidthStep: Cli.tone_on_joined (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=tone_on_joined) def tone_on_joined(takes: Bool, code: U32) -> WidthStep: Cli.tone_step (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=tone_step) def tone_step(run: EmojiRun, code: U32) -> WidthStep: Cli.joiner_run (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=joiner_run) # A ZWJ after an emoji that may join, or after a joined pictograph, waits # for the next pictograph. def joiner_run(run: EmojiRun) -> EmojiRun: Cli.vs16_widen (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=vs16_widen) def vs16_widen(widens: Bool, code: U32, join: Bool) -> WidthStep: Cli.vs16_on (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=vs16_on) def vs16_on(narrow: Bool, +code: U32, join: Bool) -> WidthStep: Cli.vs16_step (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=vs16_step) # VS16 widens a 1-wide emoji with an emoji presentation to 2, once. def vs16_step(run: EmojiRun) -> WidthStep: Cli.code_step (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=code_step) def code_step(cls: CodeClass, run: EmojiRun, code: U32) -> WidthStep: Cli.width_go (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=width_go) # acc, plus the width of step, the last code point's, and of s after it. def width_go(s: String, step: WidthStep, acc: Nat) -> Nat: Cli.width (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=width) # 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 width(s: String) -> Nat: Cli.leading_indent (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=leading_indent) def leading_indent(s: String) -> String: Cli.WrapState (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=WrapState) type WrapState is Data: WrapState{indent: String, cols: Nat, line: String, started: Bool, done: List<&2, String>} Cli.wrap_words (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=wrap_words) def wrap_words(words: List<&2, String>, state: WrapState) -> String: Cli.words (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=words) def words(s: String) -> List<&2, String>: Cli.wrap_line (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=wrap_line) def wrap_line(+line: String, cols: Nat) -> String: Cli.wrap_lines (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=wrap_lines) def wrap_lines(lines: List<&2, String>, +cols: Nat) -> List<&2, String>: Cli.wrap (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=wrap) def wrap(text: String, cols: Nat) -> String: Cli.ValueType (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=ValueType) type ValueType is Data: TNat{} TU32{} TF32{} TBool{} TFile{} TDir{} Cli.type_name (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=type_name) def type_name(t: ValueType) -> String: Cli.Item (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=Item) type Item is Data: Arg{usage: String, help: String, items: List<&2, Item>} Sub{name: String, about: String, items: List<&2, Item>} Version{value: String} Alias{name: String} Hidden{} Example{line: String, what: String} After{text: String} SubOptional{} External{} Exclusive{group: String} … Cli.Cmd (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=Cmd) type Cmd is Data: Cmd{name: String, about: String, items: List<&2, Item>} Cli.Problem (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=Problem) type Problem is Data: BadUsage{at: String, usage: String, col: Nat} BadName{at: String, name: String} Dup{at: String, name: String} Reserved{at: String, name: String} Misplaced{at: String, attr: String} NoHelp{at: String, what: String} BadDefault{at: String, id: String, value: String} BadRef{at: String, id: String} BadPositional{at: String, id: String, why: String} Mixed{at: String} … Cli.cmd (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=cmd) def cmd(name: String, about: String, items: List<&2, Item>) -> Cmd: Cli.sub (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=sub) def sub(name: String, about: String, items: List<&2, Item>) -> Item: Cli.arg (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=arg) def arg(usage: String, help: String, items: List<&2, Item>) -> Item: Cli.version (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=version) def version(value: String) -> Item: Cli.alias (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=alias) def alias(name: String) -> Item: Cli.hidden (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=hidden) def hidden() -> Item: Cli.example (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=example) def example(line: String, what: String) -> Item: Cli.after (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=after) def after(text: String) -> Item: Cli.sub_optional (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=sub_optional) def sub_optional() -> Item: Cli.external (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=external) def external() -> Item: Cli.exclusive (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=exclusive) def exclusive(group: String) -> Item: Cli.need_one (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=need_one) def need_one(group: String) -> Item: Cli.id (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=id) def id(value: String) -> Item: Cli.required (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=required) def required() -> Item: Cli.default (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=default) def default(value: String) -> Item: Cli.env (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=env) def env(name: String) -> Item: Cli.global (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=global) def global() -> Item: Cli.heading (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=heading) def heading(title: String) -> Item: Cli.as_nat (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=as_nat) def as_nat() -> Item: Cli.as_u32 (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=as_u32) def as_u32() -> Item: Cli.as_f32 (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=as_f32) def as_f32() -> Item: Cli.as_bool (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=as_bool) def as_bool() -> Item: Cli.as_file (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=as_file) def as_file() -> Item: Cli.as_dir (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=as_dir) def as_dir() -> Item: Cli.one_of (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=one_of) def one_of(values: List<&2, String>) -> Item: Cli.delim (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=delim) def delim(sep: Char) -> Item: Cli.hyphen (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=hyphen) def hyphen() -> Item: Cli.rest (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=rest) def rest() -> Item: Cli.bare (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=bare) def bare(value: String) -> Item: Cli.conflicts (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=conflicts) def conflicts(target: String) -> Item: Cli.requires (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=requires) def requires(target: String) -> Item: Cli.group (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=group) def group(name: String) -> Item: Cli.color (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=color) def color() -> Item: Cli.completions (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=completions) # Builtin{} marks the subcommands that only eval acts on (§6.4). def completions() -> Item: Cli.man (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=man) def man() -> Item: Cli.UsageKind (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=UsageKind) type UsageKind is Data: FlagKind{} CountKind{} NegatableKind{} OptionKind{many: Bool} BareOptionKind{} PosKind{required: Bool, many: Bool} Cli.Usage (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=Usage) type Usage is Data: Parsed{id: String, short: String, long: String, kind: UsageKind} Invalid{col: Nat} Cli.NameScan (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=NameScan) type NameScan is Data: NameOK{name: String, rest: String, next: Nat} NameBad{col: Nat} Cli.PhScan (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=PhScan) # PhOK's name is reversed: only a positional's name is read. type PhScan is Data: PhOK{rev: String, rest: String, next: Nat} PhBad{col: Nat} Cli.name_start (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=name_start) def name_start(+c: Char) -> Bool: Cli.name_char (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=name_char) def name_char(+c: Char) -> Bool: Cli.finish_name (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=finish_name) # rev is the name so far, reversed. def finish_name(rev: String, rest: String, +pos: Nat, +first: Bool, +dot_start: Nat) -> NameScan: Cli.scan_name (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=scan_name) def scan_name(s: String, +pos: Nat, rev: String, +first: Bool, dot_start: Nat) -> NameScan: Cli.ph_stop (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=ph_stop) # A placeholder ends at a character no name holds: at close after a name, # else with an error there. def ph_stop(at_close: Bool, rev: String, rest: String, +pos: Nat) -> PhScan: Cli.scan_ph (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=scan_ph) # The placeholder name in s up to close, reversed in rev. A name holds no # space, '<', '>', '[', ']' or '=', and close is one of them. def scan_ph(s: String, +pos: Nat, rev: String, +close: Char) -> PhScan: Cli.finish_pos (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=finish_pos) def finish_pos(found: PhScan, kind: UsageKind) -> Usage: Cli.parse_pos (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=parse_pos) def parse_pos(s: String, +repeat: Bool) -> Usage: Cli.finish_required_value (https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=finish_required_value) def finish_required_value(found: PhScan, id: String, short: String, long: String, kind: UsageKind) -> Usage: More: https://jend.leeeet.dev/packages/cli.txt?definitions_offset=100