uf

package module
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: BSD-3-Clause Imports: 23 Imported by: 1 module, 0 packages

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

README

uf: the ultimate declarative command-line language.

uf is a small language and set of tools for describing and working with command-line programs.

The focus is on an intentionally simple and rigid grammar that is easy to write and read at a glance for people and machines of all kinds.

go reference a picture of a chalkboard where I wrote out uf.uf with manual syntax highlighting via colored chalk the same picture but with tapirs

This README is easier to read with syntax highlighting, but gitlab doesn't recognize uf yet. Read a syntax-highlighted PDF in dark, light, or plain format.

1. See also

2. Table of Contents

3. Quickstart

3.1. Installation
3.1.1. From a precompiled binary
target operating system architecture who it's for
uf-darwin-amd64 darwin amd64 older macOS machines (pre M1)
uf-darwin-arm64 darwin arm64 newer macOS machines (M1 and later)
uf-linux-amd64 linux amd64 Linux machines with AMD64 architecture (most of them)
uf-linux-arm64 linux arm64 Linux machines with ARM64 architecture
uf-windows-amd64.exe windows amd64 Windows machines with AMD64 architecture (most of them)
uf-windows-arm64.exe windows arm64 Windows machines with ARM64 architecture
3.1.2. From VS Code extension

install the ufls extension; ideally, it should "just work".

3.1.3. From source

You'll need Git, Go 1.27.1 or newer, Make, and Bash, and ideally man-db.

These scripts may help, but you don't need them:

Or just...

git clone --depth 1 https://gitlab.com/efronlicht/uf.git
cd uf
make init
UFPATH="$HOME/uf" "$HOME/bin/uf" explain -- grep -A

Use make init to set up uf. The makefile's comments should help you get oriented.

4. Troubleshooting:

4.1. UFPATH

uf tools search the UFPATH environment varaiable for .uf files and caches. Like the PATH and LDPATH environment varaibles, this is a list of readable (and hopefully writable) directories separated by your OS's path separator.

For example, if UFPATH="/Users/efron/uf:/shared/uf", then uf tools will search first in /Users/efron/uf and then in /shared/uf. By convention, UFPATH is $HOME/uf (for me, /Users/efron/uf.

4.2. HINTS
  • check your PATH and UFPATH.
  • If something goes wrong, make clean will remove all build artifacts: make reinit should completely rebuild by doing clean then init.

5. CLI Demos / "Advertising"

uf borrow: convert man and tldr pages to .uf (or combine them)

uf borrow help and options

uf syntax: get a helpful next step when the grammar input is missing

uf syntax argument guidance

uf syntax: autogenerate Sublime-style syntax from formal grammars

uf syntax generating editor rules

5.1. Explanations and shell completions

uf explain: searchable, machine- and person-friendly explanations for thousands of commands, straight from the source

uf explain showing imported zstd options

uf complete: fast, thorough autocompletions for thousands of commands (Bash)

Bash shell completion

uf complete: fast, thorough autocompletions for thousands of commands (Zsh)

Zsh shell completion

6. Why Build UF?

NOTE: Much of section 6 ("why UF") is currently an outline which is a bit terse, cryptic, and shattershot: me recording my thoughts "raw" while they're still fresh. I plan to clean this up in the future, as well as creating a retrospective on the design process.

The unix guys were right: you do want small individual programs you can chain together. But it's harder to do this than it should be. CLIs will always be less intuitive that GUIs in some ways, but we can do our best to make this as painless as possible.

6.1. Problems with current CLI ecosystem

Problem with chaining together programs is that the documentation breaks down very quickly: no nice hover-text in your IDE, no uniform description of APIs, etc etc.

  • those tools are poorly documented, inconsistent

    • manpages are notoriously hard to parse: even LLMs struggle with them!
    • do I do man cmd? tldr cmd? cmd help? cmd -h? cmd help --?
  • CLI parsing is usually almost the same but not exactly the same across languages and libraries

    • Do you support repeated arguments? Yes or no? How about flags after positional arguments? How about the end-of-flag -- marker?
    • Theres a huge number of different libraries out there which come in too flavors:
    • slightly underfeatured (eg, go's flag, getopt)
    • far too complex (cobra, clap, argparse)
  • Can we hit a happy medium? What are the things we actually need and use in practice? We have 50 years' history of command-line programs to use as a source dataset: let's find the minimal combination of features that works for almost every command-line program in pratice.

    • Yes: types: ints, floats, durations, bools, times, strings, enums
    • No: structs, maps, unions
    • Yes: repeated args, optional args, bool shorthand, enums, subcommands
    • Maybe? aliases (very common: probably need some support if you're going to support pre-existing commands, but I don't like them)
    • No: arbitrary flag prefixes (+, no -): too confusing
6.2. Information Theory: Core Design

We want as high of a signal/noise ratio as possible. Grandpa Paul: Cybernetic efficiency: the ratio of information used to accomplish some useful work, compared to the theoretical minimum information necessary

Removing unnecessary variation: how can we have exactly one normalized output?

  • Simplify:
    • Flags MUST go before positional arguments, always
    • all flags, envs, and positionals MUST have unique names
    • no (official) support for aliases
    • Declaration grammar is rigid
    • Uniquely named declarations
    • Exactly one line per declaration
    • All grammatical types have unique prefix chains
    • No free-floating comments
    • Consistent quoting rules: only quote things that need quoting, ever: characters that can be escaped MUST be escaped: no unescaped newlines in values ever
    • Flags must start with -
  • Normalize
    • Sort everything that can be sorted:
    • Sort by declaration type first
    • Flag and environment orders within examples can be normalized by key
    • Normalize in an order for human beings: we expect to see -a, --Aardvark, and --apple close together
6.3. Adoption friction

Writing .uf should be easier than writing the equivalent command-line parsing code, and writing it should save you from having to think about or generate that code. uf gen to create the parser for whatever language.

6.3.1. Performance

Things like autocomplete, initialization, etc are only useful if they are FAST!

TODO: more about performance design here.

6.3.2. learning the language: ufls

uf is simple but that's not the same as easy, learning a language is always hard

  • difficult to approach a language without tooling, syntax highlighting, helpful error messages:

    • error messages should guide users to the successful path, not just say what went wrong
    • always parse or process as much as possible at a time to give maximally helpful error context
  • ufls should have hover text that explains components as it works:

  • we can even explain the hard parts of the shell:

    • end of flag --: explaining end of flag --
    • redirection:
    • regexp patterns are probably the most complicated part of the language, so explain it like regex101

uf syntax + ufls: use generated syntax for clear highlighting in your editor

uf syntax highlighting in uf.uf

ufls: get helpful hover text for regular expressions, like regex101

UFLS regexp hover help

ufls: browse related command specifications without leaving your editor

Browsing UF command specifications

6.3.3. how to set up?: uf core toolchain, uf init

The easiest way to lose someone is if it's painful to set up. uf should "just work" for a huge cross-section of the populace:

  • windows/mac/linux
  • amd64/arm64
  • fish/bash/zsh: (TODO: powershell?)
  • Most users don't understand the SHELL and PATH that well. Expecting people to set up complicated dependencies is kind of rude for something that is supposed to help.
6.3.4. actually existing documentation systems: uf borrow, uf lend
  • Why would I use uf over man or tldr when they already exist?
    • converting other documentation to uf (because they've already written it): uf borrow man, uf borrow tldr to automatically convert

people might be reluctant to write documentation if uf if it doesn't take off. we should respect that (most projects don't). solution: uf lend to turn .uf back into man or tldr.

6.3.5. No one wants to write things twice: generating code: uf gen
  • If "uf" is 'universal', it should parse exactly the same in every language.
    • Simplify the grammar as much as possible to make this feasable: (times: RFC3339 only, durations: no mixed units)
    • So generate identical behavior rather than relying on / wrapping per-language libraries.
    • Fuzz tests can make sure the outputs are the same for the same input.
  • What languages? Ideally, everything, but start with the ones I understand. Make a reference implementation by hand in go that uses as little library code of any kind as possible, then use LLMs and fuzz tests to adopt to other languages: I can supervise b/c I'm familiar.
6.4. Why now? UF and the age of LLMS

The world of the future will be an even more demanding struggle against the limitations of our intelligence, not a comfortable hammock in which we can lie down to be waited upon by our robot slaves.

Norbert Weiner, The Human Use of Human Beings (1950)

uf is a very traditional software tool in the UNIX tradition. Why release something like this now when LLMs are all the rage?

LLMs have changed the process of software engineering a lot, in both good ways:

  • easier production of code, especially by non-experts
  • simplification of certain kinds of refactors and migrations
  • very good at certain kinds of "pattern-matching" code that is hard to create manually but very useful (AST rewrites, etc))

But also in bad ways

  • entirely new categories of software bugs!
  • incomprehensible output!
  • even buggier, slowier software on average!
  • even more ludicrously disconnected-from-reality expectations from middle-and-higher management!
  • 'professional' software engineers who don't know the slightest thing about how their own software works!

How can we take advantage of the strengths of this technology while mitigating the downsides? This big of a question to solve in one go and probably too early to know for sure (and there's a certain kind of hubris to trying to assuming there's always a technological solution to a cultural/social problem) - but maybe better tooling can help?

Go is much easier to understand than C because you can read it from top to bottom, left to right: no "left const" vs "right const" nonsense: this is true for both people and LLMs.

LLMs are good at simple, regular languages and bad with ambiguity: solution: make a simpler and more regular language to remove ambiguity!

  • LLMs are bad at organizing information by importance... so don't do that: instead organize it consistently in some other way! (idea: extreme autoformatting well beyond go fmt)
  • LLMs are "compression in reverse": make text that has regular prefixes and non-recursive, LL(1) parsing that compresses very well.
  • "That's not what I meant" - Provide reliable, deterministic tools that people can use easily alongside, instead of, or through LLMs.
  • Don't make people choose between LLM usage or not: uf should help them regardless of their approach.
  • In all cases: good performance, clear specifications written by human beings, explicit help guidance: "did you mean?", file:line:col 0xoffset errors help people stay on track and fall into the "pit of success" (this was always important but ever-more-so).

The idea of "extreme autoformatting" is one I'm exploring in more detail through gitlab.com/efronlicht/rewrite

6.4.1. Documentation
  • Good documentation already exists (manpages, tldr-pages, --help) - but is irregular in format, hard to search and find, ever more so with legions of LLM slop polluting the internet. So people rely on LLM search instead, which is inherently inaccurate (and worse because it can't find good documentation). We can get mad at people for intellectual "laziness" (and I do), but it's not very productive: can we make it easier for people to get good documentation? (And if they do rely on LLM search, we while we can't avoid the stochastic nature of LLM output polluting it with nonsense, we can at least give the LLM a higher-quality source of information...) Solution: uf borrow to combine pre-existing doucmentation sources and collate them in a useful and human-and-machine-readable way, uf explain to have a good way to find it, ufls to explain examples.
6.4.2. Computer Use
  • Computer use: LLMs are very good at chaining together programs: "computer use" in the traditional UNIX/sysadmin sense. But they use bad programs badly and get stuck often - unbelievable how many times I've seen LLMs make simple mistakes with "standard" tools with confusing or poorly documented APIs (find, awk, etc.) People have these problems too, of course! Then there's wasted CPU and person time finding the right way to do it... **solution: error-correcting feedback to guide the user to the correct solution: did you mean "-H".
  • Faster, more consistent, more reliable APIs -> less wasted time and energy
6.4.3. Software Development
  • Software development: LLMs like to reinvent the wheel badly, make over-complicated APIs and corrode structure.

    • Reinvent the wheel badly: stop them! Have rigid standards for what the wheel is (uf),and actual code generation to have the same wheel every time! uf gen
    • Over-complicated APIs: keep human eyes on the API: it should be easy to fidlde the actual "shape" of the program and communicate those changes to people and machines while you're iterating on a design. : (fundamnetal design of .uf itself).
    • Corrode structure: don't tie together too many parts of the design so that damage doesn't leak. We've known for decades that cat -v considered harmful: make small tools that do one thing and compose them rather than contorting them... but this is hard when there's a big barrier to making a new program or learning the API of one: solution: uf lowers the barrier.
  • Solution: have the LLM do as little work as possible! .uf is a constrained target with extremely regular text; harder for LLMs to write something truly silly: use uf gen to provide uniform plumbing rather than having the LLM reinvent plumbing in confusing/stupid ways.

  • LLMs and people are are easiest to guide by example: so surface examples!

  • Documentation mismatch / rot: even pre-LLM, it was always easy for docs to get out of sync with the actual behavior of the program: this has reached a state of crisis with the speed of turnover in LLM-assisted software development. Solution (ok, mitigation): make the documentation load-bearing: move more and more 'documentation' into the typesystem so that it can't drift: remove unnecessary layers so as to avoid confusion.

A personal thought: I think most people are hostile to LLM-touched code because most of it is so obviously thoughtless and shit. I don't blame people for their hostility: a default of extreme suspicion towards LLM-heavy work is not only understandable but in most cases extremely justified (and that's not getting into the complex waters of the ethical, political, economic, sociological, and ecological consequences, all of which are worth discussing but well out of the scope of this README). If we simply turn up our noses, we may be needlessly ceding the field to the worst actors in it, and worse yet, leaving the next generation of programmers to be shaped by them.

This project exists to some extent to test a thesis: rather than using LLMs to half-ass big projects, can we use them to help small projects get closer to perfection, to make cleaner, simpler, more reliable, more comprehensible building blocks for our ever-more-technological society to build upon? I think so, though it's not easy. This is an uphill struggle, both against/within the structure(s) and organization(s) in which most software is built, and the incentives of our software industry in general, so it doesn't show up much in practice, but that doesn't mean it's not possible or not worth it.

I do not see why a potentially powerful tool to improve software necessarilly has to doom us to drown in a pit of slop, even if that is the current 'path of least resistance' for our deeply unhealthy industry.

As a side note, I also think many people rely on LLMs when they shouldn't because we have not made good alternatives available to them.

  • "Traditional" Google search is dogshit nowadays (something google did on purpose), so people just use the LLM summaries;
  • "Traditional" CLI learning tools are not available or highly inconsistent - I know half a dozen programmers who use claude when what they "really" want is tldr (or better yet, uf ;)

7. uf toolchain overview

Last updated: v0.3.1; 2026-11-07.

Each command links to its embedded .uf specification: these and the source code are the source of truth (and easier to read, to boot)!

name invocation library entrypoint description example example description
uf uf uf.go cmd/uf/main.go core toolchain; delegates to other commands uf -h show toolchain help and subcommands
ufborrow uf borrow cmd/ufborrow/cli/borrow_man.go, cmd/ufborrow/cli/borrow_tldr.go cmd/ufborrow/main.go convert man or tldr pages to .uf files uf borrow man import man-page documentation into .uf specs
ufclean uf clean cmd/ufclean/ufcleancli/main.go, vendor/.../rewrite/mode.go cmd/ufclean/main.go clean the UF configuration uf clean -n preview cache and completion cleanup
ufcomplete uf complete ac/ufcomplete.go cmd/ufcomplete/main.go turn .uf files into shell completions uf complete -lang fish command.uf write Fish completions for command.uf to stdout
ufexplain uf explain ufexplain/explain.go cmd/ufexplain/main.go explain a command by reading its .uf file uf explain -- grep -A -B -C show grep's three context options and matching examples
uffmt uf fmt uffmt/fmt.go cmd/uffmt/main.go format .uf files uf fmt -d ugly.uf show formatting changes without modifying ugly.uf
ufgen uf gen ufgen/generate.go cmd/ufgen/main.go generate native argument parsers from .uf files uf gen go cmd/example.uf generate a Go argument parser from cmd/example.uf
ufhelp uf help uf.go cmd/uf/dispatch.go show the specification for a command (deprecated: prefer uf explain.) uf help borrow show the embedded .uf specification for uf borrow
ufimport uf import ufimport/import.go cmd/ufimport/main.go copy .uf files into the user command directory uf import ./command.uf copy command.uf into the configured UFPATH
ufinit uf init ufinit/init.go cmd/ufinit/main.go create starter specs and shell completions uf init create the default UF directory and install completions
ufinstalltldr uf install-tldr cmd/ufinstalltldr/ufinstalltldrcli/main.go cmd/ufinstalltldr/main.go install the tldr client and its Rust toolchain uf install-tldr install tealdeer and refresh its page cache
uflend uf lend man/write.go, internal/tldr/tldr.go cmd/uflend/main.go turn .uf files into man pages or tldr pages uf lend tldr export command specs as tldr pages
uflist uf list uf.go cmd/uf/dispatch.go list UF commands and their descriptions uf list list available UF subcommands and descriptions
ufmcp uf mcp ufmcp/ufmcp.go cmd/uf/dispatch.go expose UF specs, validation, and output-only tools over stdio MCP uf mcp start the UF MCP server
ufsynopsis uf synopsis cmd/ufsynopsis/ufsynopsiscli/main.go cmd/ufsynopsis/ufsynopsiscli/main.go generate command-line synopses uf synopsis grep print grep's one-line Usage synopsis
ufsyntax uf syntax sublime/syntax.go cmd/ufsyntax/main.go generate editor syntax rules from the UF grammar uf syntax uf.abnf generate TextMate/Sublime syntax rules from the grammar
ufls uf ufls ufls/server.go cmd/ufls/main.go run the UF language server UFPATH="$HOME/uf" uf ufls start the language server with the user's specs

8. Language Reference

8.1. Introduction

uf is a line (\n)-based command-line declaration format.

uf is made up of UTF-8 text separated by newlines.

A line can be one of these things:

  • All whitespace (skipped)
  • The shebang starting with #! (first line only)
  • A comment starting with # (attached to exactly one declaration)
  • A declaration starting with app, parent, copyright, flag, env, or arg1 through arg9
  • An example line starting with example; this is separate from declarations and its command text is opaque to UF
  • An error (anything else)

arg0 is rejected. arg1 is always the first positional argument; later arguments must use consecutive numbers.

UF always tries to be maximally helpful by collecting as many errors as possible and relevant context, including file, line, column, and hexadecimal offset.

As an example, a uf spec for the Unix command echo (echo.uf) might look like this:

#!/usr/bin/env uf

# echo the given arguments to stdout separated by spaces, and terminate with a newline ('\n').
app echo

copyright uf "Efron Licht" 2026 "BSD 3-Clause License"

flag -n bool = false # suppress newlines
arg1 args string* #

example echo hello world # print the string 'hello world\n'
example echo -n nonewline # print the string 'nonewline'
8.2. The Shebang (#!/usr/bin/env uf)

Every uf file should start with the shebang #!. The shebang MUST be on the first line and can ONLY be on the first line.

(TODO: This doesn't actually do anything in most circumstances; it should automatically call uf import and then uf explain - but for now it helps make the filetype unambiguously recognized as a uf script by people, LLMs, and deterministic tools.)

8.3. Comments: # <comment>

An unquoted # immediately starts a comment that continues to the end of the line. Repeated lines containing comments are considered a single comment block. Each comment block must be attached to exactly one declaration: an app, env, flag, or arg declaration.

That is to say, you can have a declaration without a comment, but not the other way around.

By convention, the toolchain may mark comments with metadata in brackets to indicate provenance, such as [tldr] and [man] for autogenerated comments via uf borrow.

8.3.1. Comments: Normalization

uf normalizes and wraps comments to keep line lengths consistent. It does not split words, and it respects deliberate newlines (\n\n).

8.3.2. Comments: Markdown

Some parts of the uf toolchain interpret comment blocks as markdown text.

# this is a comment that is associated with arg1
arg1 path string # and this will be the second part of the comment

A comment must be attached to something: it has to sit immediately above an app, env, flag, or arg declaration, trail one on the same line, or act as the app doc comment immediately before the app declaration. A comment separated from the next declaration by a blank line is a parse error.

8.4. Declaration
  • A declaration takes up exactly one line and may have at most one attached comment.
  • Within the same kind, declarations will be ordered lexicographically after trimming leading - and ignoring case. (i.e, -Ab comes before --aB).
  • Declarations start with one of these keywords: app, copyright, parent, flag, env, or arg1 through arg9. example is a separate line form, not a declaration.
8.4.1. app

app declares the program itself. You can have at most one.

By convention, the comment attached to the app declaration serves as the overall description for the program. The first sentence in this comment is typically treated as a brief summary by tooling like uf explain.

app grep # regular expression search for patterns in files

copyright declares licensing and ownership. They are in the form:

copyright <what> <who> <YEAR> <License>

8.4.3. parent and subcmd

subcmd is a positional-only type. The subcommand entry in the parent and the child's parent declaration must match:

app foo
arg1 command subcmd [foobar:bar] # foo has a child, 'foobar', which you can invoke as `foo bar`

app foobar
parent foo bar # foobar has a parent, 'foo', who invokes me as `foo bar`

foobar is the child's identity and bar is the spelling used by the parent. Arguments after a selected subcommand are forwarded to it.

8.4.4. Variable Declarations: flag, arg1..=9, env.

All the other declarations declare variables. Those declarations come in the form:

kind name type [repeat] [bounds] [= default] [# comment]?

8.4.5. Kinds

kind is one of flag, env, or arg1 through arg9.

  • flag declares a command-line flag.
  • env declares an environment variable.
  • arg1 through arg9 declare positional arguments.

example lines are separate from variables and declarations.

8.4.6. Names

Every variable declaration must have a unique name within the same uf file. These names follow the quoting and string normalization rules described below.

uniqueness is both within and between categories. In addition, flag names MUST start with at least one dash: -v, --force.

By convention, variable names follow these patterns:

  • positional arguments are named in lowercase without any hyphens: cmd, n, file.
  • environment variables are in SCREAMING_SNAKE_CASE: NO_COLOR
  • long flags use two dashes and are kebab-case: --color, --output, --verbose, --multiple-words.
  • short flags use a single dash: -v, -o.

UF strongly discourages aliases (i.e, -f and --force meaning the same thing) and does not officially support them, though some of the toolchain may provide limited support for backward compatibility.

8.4.7. Flags

flag -<name> <type> (<repeat>)? (<bounds>)? (= <default>)? (# <comment>)?

Flags must start with -. When evaluated, flags always go before positional arguments in the command-line order.

flag --color string [always auto never] = auto # note the bounds here
flag -output string = out.txt
flag -verbose bool = false

Flag names may use one or two dashes:

flag -v bool
flag --verbose bool
8.4.8. Evaluating Flags

Flag parsing runs from the beginning of the command-line arguments until the first recognized positional argument or the end-of-flags marker --.

  • A non-bool flag appears as -flag value or --flag value.
  • A bool flag appears in the command-line arguments without a value.
8.4.9. Positional Args (arg1..=arg9)

argN name type [repeat] [bounds] [= default]

Positional args use arg1 through arg9. They have the following types: bool, int, float, duration, time, string, and subcmd.

You can't skip an argument in the middle of the sequence; they must be specified in order, starting with arg1. Only the final arg can be a subcmd: you may have at most one.

Positional Args: Repeat Markers
  • Once you have a ?, the remaining arguments must be ? or *.
  • Once you have a + or *, it must be the last argument in the sequence.
  • A subcmd may have ? but not + or *.
app grep
arg1 pattern string
arg2 files string*
8.4.10. Environment Variables

Environment variables use env.

env name type [repeat] [bounds] [= default] [# comment]?

env COMPRESSION_LEVEL int [1..=9] = 3
env BACKGROUND_COLOR string [grey gray:grey white black] = grey

Because operating systems and shells handle duplicate environment variables so inconsistently, it is not advised to use the ? and + repeat markers for environment variables.

8.5. Types

A flag, arg, or env declaration has a base type and optional repeat marker and value bounds.

The supported types are bool, int, float, duration, time, string, subcmd.

8.5.1. bool

bool is the literal true or false. Boolean flags do not take a value; their presence inverts the default. Use a string enum such as string [none true false 1:true 0:false] when a setting needs those values.

bool may not have the repeat markers ?, *, or +, and must have a default. (true or false).

8.5.2. int

int is a 64-bit signed two's complement integer in the inclusive range [-0x8000000000000000, 0x7fffffffffffffff] (decimal: [-9223372036854775808, 9223372036854775807]). You can represent integers in decimal (42069), hexadecimal (0xdeadbeef), octal (0o377), or binary (0b11111111) form. Digit separators (_) are supported.

It is illegal to have a default value outside this range. You can use bounds to narrow but not expand the range of valid values. Normalization may convert the representation to an equivalent form.

8.5.3. float

float is an IEEE 754 double precision floating-point number. It is illegal to have a default value outside the range of representable values, but you can use bounds to narrow the range. You can use decimal notation (3500.10) or scientific notation (1.5e2). Autoformatting will normalize the representation as though with Go's fmt.Sprintf("%g", x)

The handling of subnormals, infinites, and NaNs is not yet defined. I will probably reject subnormals and NaNs but allow + and - inf, but I haven't decided yet.

8.5.4. duration

duration is integer literal followed by exactly one unit: ns, us, ms, s, m, or h. Durations are nanosecond counts in the range [-0x8000000000000000ns, 0x7fffffffffffffff], or approximately +/- 290 years.

Mixed units and fractions are not allowed: normalization will convert the duration to the largest unit with no precision loss.

Note that we use us for microseconds instead of µs.

in normalized
3600s 1h
550000us 550ms

No mixed units or decimals: 100.5ms, 5h30m.

8.5.5. time

time is an RFC3339 timestamp like "2026-09-18T12:00:00Z", parsed exactly as with go's time.ParseDuration(time.RFC3339, s). Normalization: timestamps will always be converted to UTC.

I may or may not allow time.RFC3339Nano in the future. If I do, time.RFC3339 values will continue to parse, and normalization will favor RFC3339 so as to remain backwards-compatible.

8.5.6. string string is a sequence of characters. Strings can be unquoted ASCII text in [a-zA-Z0-9_-] or quoted Unicode printable text: see normalization and quote rules.
8.5.7. subcmd

subcmd is another command-line program. (For example, git has the subcommands commit, branch, etc, and uf itself has init, complete, gen, etc.)

It is a positional-only type. Arguments following a subcmd are forwarded to it. You can have at most one subcmd, and it must be the final positional argument.

Design note: maybe subcmd should have been its own kind of declaration rather than being bolted on to positional arguments. Still, it works pretty well and recurses nicely.

8.5.8. Repeat Markers (?, *, +).

Add a repeat marker to indicate how many values are allowed for a flag or argument. Repeats go immediately after the type.

Repeat markers are ?, *, or +, following the same rules as regular expressions:

  • ?: zero or one value
  • *: zero or more values
  • +: one or more values

Boolean declarations can't use repeat markers.

app examplerepeat
arg1 path string+ # one or more file paths
8.5.9. Default

env, flag, and argN declarations can have default values. The default must properly parse as the type.

flags without a written default usefalse`.

Bare defaults must be ASCII letters, digits, _, or -.

flag -mode [w l d] string = fast # bad: fast isn't in the list!
flag -title string = "hello world"  # normal quoting rules apply...
flag -city string = "東京" 
flag -word string = "mañana"

Types can have bounds to further restrict their values.

8.6. Bounds

You can restrict the range of valid values for a flag or argument using bounds. No bounds means no restriction; otherwise, matching ANY bound is OK. There are three kinds of bounds: ranges, enums, and patterns.

8.6.1. Enums [a b k:v]

For a limited set of explicit values, use an enum bound. Enums can either be a list of values of the base type or a mapping of string keys to values of the base type.

app boundsexample
arg1 animal string [cat dog rabbit] = rabbit # must choose one literally of 'cat', 'dog', 'rabbit'

app boundsexample2
arg1 animal string [cat dog rabbit bunny:rabbit] # 'bunny' is interpreted as 'rabbit'
8.6.2. Ranges [MIN..=MAX]

nge of values. A range bound appears in one of these forms:

  • [MIN..=MAX], where MIN < MAX: the value must be greater than or equal to MIN and less than or equal to MAX.
  • [MIN..]: the value must be greater than or equal to MIN.
  • [..=MAX]: the value must be less than or equal to MAX.
  • [..=] and [..] are not legal, just eliminate them.

Design note: originally, uf just did this with patterns. This works but is an enormous mental burden - you have to carry a regexp state machine in your head when you should be thinking about numbers. So I added the range bounds.

Note: since there are no unsigned integers, make sure to set 0 as the minimum value if you want to emulate an unsigned range!

flag -range int [1..=10] = 5
flag -positive int [1..] # positive integers only
flag -grade float [0..=100] # grade must be between 0 and 100 inclusive
arg1 unsigned int [0..] # 0 <= unsigned
8.6.3. Subcommand Enums [realname:invocation]

Subcommand enums are like regular enums, but they refer to subcommands. They map subcommand names to their invocation strings.

app foo
arg1 command subcmd [foobar:bar] # "foobar" is invoked as `foo bar`
app foobar
parent foo bar

If you omit the value, the key itself is the value.

app selfmap
arg1 command subcmd [foo bar:baz] # "foo" is invoked as `selfmap foo`, "bar" as `selfmap baz`

Design note: I kept going back and forth on whether this should be the other way around: which one is the key and which is the value? I am least satisfied with this of anything in uf, but the other way around has its problems too...

8.6.4. Regexp Patterns [~"PATTERN"]`

Pattern bounds allow you to specify a RE2-style regular expression. See Go's regexp/syntax for the full syntax, but there shouldn't be many surprises.

The pattern bound is specified inside the square brackets with a tilde ~ followed by the pattern in quotes. Most patterns will want the start anchor, ^, and the end anchor, $, to match the whole string.

The pattern matches against the provided value BEFORE parsing and enum matching.

flag -hexint int [~"^0x[0-9a-fA-F]+$"] = 0x1
flag -username string [~"^[a-zA-Z0-9_]+$"] = user_123
flag -date string [~"^\d{4}-\d{2}-\d{2}$"] = "2024-06-01"
8.6.5. Combined Bounds

A declaration can have multiple bounds: a value satisfies the bounds if it meets at least one of them. (This lets you have predefined named values while still allowing raw values within a certain range.)

Put the bounds in one [] section:

flag -color int [0..=0xFFFFFFFF red:0xFF_00_00 green:0x00_FF_00 blue:0x00_00_FF white:0xFF_FF_FF] = white
flag -input string [~"^[./].+" "-"] # a filename starting with `.` or `/`, or `-` for stdin
env LOGLEVEL int [-32..=32 debug:-4 info:0 notice:1 warn:4 error:8] = info
8.6.6. Bound Examples

Bounds are pretty versatile. Here are some examples that may be handy in practice.

Ports
flag -port int [0x400..=0xFFFF] = 8080 # ports below 0x400 are reserved. 8080 is a conventional port used for local HTTP servers.

Many more sophisticated bounds can be approximated with regular expressions.

File paths
flag -filepath string [~"^[A-Za-z0-9._/-]+$"] # slash-separated path text
IP addresses
flag -ip string [~"^(?P<ipv4>([0-9]{1,3}\\.){3}[0-9]{1,3})$"] # IPv4 shape, not a check that each number is 0..255

Please note that while UF allows named capture groups, and I use them here for clarity, it does not actually use the captures - groups are just for grouping.

Structs

I discourage this, but if you need it, a single struct is best specified by just having one required field for each component:

flag --pt-x float = 3
flag --pt-y float = 4
flag --pt-z float = 5
Maps

A mapping (like docker build's --config flag) can be represented as a repeated key=value flag with a validating regular expression:

flag --config string* [~"^[^=]+=[^=]+$"] # repeated pairs in the form key=value
Fixed-size arrays

A fixed-size array can be represented using --arr-0, --arr-1, etc, for each element in the array, but i'd strongly recommend against it.

flag --arr-0 int = 0
flag --arr-1 int = 0
flag --arr-2 int = 0

Or it can be represented as a repeated flag with a validating regular expression, though you'll have to parse:

flag --array string* [~"^[0-9]+(,[0-9]+)*$"] # multiple arrays of integers in the form 1,2,3

ufborrow uses bounds extensively.

9. Appendix

9.1. Normalization

Declarations are ordered by kind in the following canonical order: app, copyright, arg1..arg9, flag, env, example.

9.1.1. Text Encoding: utf-8

uf is always valid utf-8 text. It will never contain non-ASCII whitespace characters, control characters, a BOM (Byte Order Mark), or other non-printable characters.

Non-quoted ,, \t, and \r are treated as the literal space character.

9.1.2. "lexish sorting"

uf uses a somewhat unusual sort order for some elements: trim leading -, if any, then compare byte-byte-byte, ignoring case. It is semi-lexicographic. Lex-ish.

9.1.3. Quoting

Some values and variable names in uf files must be quoted. A quoted value is enclosed in double quotes ("). Quotes respect these escapes:

escape name hex code
\" double quote 0x22
\\ backslash 0x5C
\n newline 0x0A
\t tab 0x09
\r carriage return 0x0D
\xx hex byte 0x00-0xFF
\u{XXXX} Unicode code point 0x0000-0x10FFFF
> Design note: originally you just used regexp pattern literals: "cat dog rabbit
9.1.4. Syntax highlighting

Many uf tools provide colored output via Sublime syntax. The uf syntax command generates these rules from uf.abnf during make generate.

9.2. rejected features

There's lots of things uf could have done but doesn't. The choise of what not to do is as important to the design as the features, if not more so.

9.2.1. types
  • types: times: RFC3339Nano? (too long! maybe formatting in whichever is shorter would solve it... I could do that backwards-compatible.)
  • types: bounds: named patterns: too clever.
  • types: fancy math (polar, multidimensional, complex, linear algebra, etc): no one would use them. go's complex numbers are famously unused.
  • types: fixed-size ints (uint8, int8, uint64): handled by bounds for our purposes:
  • types: huge floats (>float64): use strings with bounds
  • types: huge ints (>int64): use floats or strings with bounds.
  • types: ints and floats: Extended or arbitrary-precision
  • types: small and weird floats (bfp8, float32): use floats with bounds.
  • types: composite types (structs, tuples): better handled via explicit flags for each subfield -a.x, -a.y, etc.; repeated structs are probably too complex for command-line integration and you should use I/O
  • types: maps: complicated: usually a bad idea for command-line APIs: you can do repeated key=value flags instead, e.g., flag --config string* [~"^[^=]+=[^=]+$"]. Code generation is probably not too bad (everyone has hashmaps), but why?
  • types: any: dynamic typing tends to spread like kudzu.
  • types: fixed-size arrays: why? When? Code generation gets hard, not all languages have them.
  • types: repeats: {m, n} repetition like regexps: when would it happen in practice? I've never seen it. If I'm wrong, you can just use + or *.
9.2.2. systems programming
  • uf explain, uf complete: file sizes: compression of .uf or completion files - tried it, didn't help. The large files are low-entropy (i.e, they contain a lot of unique prefixes), and the small files are so small compression won't actually change the amount of reserved disk space.
  • uf (all): just use a DB like postgresql or sqlite instead of making a zillion files and doing sharding myself like an idiot: yeah, probably I should have.
9.2.3. language design
  • supported encodings besides uf itself and json (protobuf, etc): why? Lots of extra complexity. Turn the JSON into another format if you need it.
  • flag or environment variable aliases; e.g, -f and --force being the same thing. (I think this is a bad habit.) However, since so many other utilities do it, the toolchain notes it via comments. (Maybe this was the wrong idea and I should have built it in?)
  • system-dependent bounds: "an available port", "an existing file with r/w permissions": difficult to implement, system-dependent.
  • multiline strings of any kind: more difficult error recovery and parsing, for both people and machines.
  • flags patterns other than -flag or --long-flag: no reason gramatically to do this, but this behavior would be extremely counterintuitive. In practice, people expect a --flag to look like a --flag; there are a handful of old UNIX utilities that do this but I'd rather break compatibility than allow this.
  • distinctions between -short and --long: (why? - is just a character.)
  • shell parsing in example: being able to treat examples as shell scripts is super handy for tools like uf ufls, but enforcing that as part of the language is an infinitely deep rabbit hole. its best to let language boundaries be language boundaries, for the same reason as the markdown comments. (also, which shell? which version?)
  • "fall-through" configuration: default < env < flag: difficult to follow, why? pick one. causes far more problems than it solves in practice; leads to no one knowing where anything is coming from.
  • "layered" configuration, like kubernetes overlays: an indirect poison in practice.
  • environment namespacing like viper/cobra: e.g, declare namespace MYAPP_, then env FOO is "really" env MYAPP_FOO: enormously confusing for no real benefit in practice. screws over environment variables which are meant to be shared.
9.2.4. secrets

seems way too likely people will just make mistakes and accidentally put their secrets in the file. I don't want uf causing credential leaks, even through honest mistakes. that can be someone else's problem.

9.3. Formal Grammar

Sourced from uf.abnf on 2026-11-05.

; ABNF grammar for one physical line of a uf file, used for parser generation and fuzz input generation.
; Keep every production and example comment in sync with uf.ebnf.
; and 0x forms with _ between digits. 
; Regexps are as https://pkg.go.dev/regexp/syntax

; one physical line: 'flag -v bool', `app uf`, etc.
spec = line
; a declaration, example, comment, or empty line: '# search options'.
line = example / copyright / [ app / parent / decl ] [ [ ws ] comment ]
; an app declaration: 'app grep' or 'app "!"'.
app = %s"app" ws app-name
; a parent declaration: 'parent uf explain'.

parent = %s"parent" ws string-value ws string-value

; a copyright declaration: 'copyright uf "Efron Licht" 2026 "BSD 3-Clause" "https://example.com/license"'. 
;  links used to be in the grammar according to rfc3986: https://www.rfc-editor.org/info/rfc3986/#appendix-A.
copyright = %s"copyright" ws ident ws quoted-string ws decimal ws quoted-string [ ws quoted-string ]

; an opaque example line with ASCII spacing: 'example grep -i pattern file'.
example = %s"example" ws bash-command

; one input declaration: 'flag -v bool = false'.
decl = source ws name ws type [ repeat ] [ ws bounds ] [ ws default ]
; an input category: 'arg1' through 'arg9'.
source = %s"flag" / %s"arg" nonzero-decimal-digit / %s"env"
; one positional argument digit: '1' through '9'.
nonzero-decimal-digit = %x31-39
; an input name: '--color' or a quoted flag such as '-?'.
name = option-flag / quoted-string / ident
option-flag = %s"-" [ %s"-" ] flag-name
; the part after the first dash in '-color-mode':
flag-name = ( letter / decimal-digit ) *( letter / decimal-digit / %s"_" / %s"-" )
; an undashed name: '_input1'.
ident = ( letter / %s"_" ) *( letter / decimal-digit / %s"_" )
; a bare app name: 'my-app2' or 'My-App2', or a quoted command name such as '!'.

app-name = app-bare-name / quoted-string
app-bare-name = letter ( letter / decimal-digit / %s"_" / %s"-" ) *( letter / decimal-digit / %s"_" / %s"-" )
; a string value used by parent metadata: 'uf' or '"uf tools"'.

string-value = atom / quoted-string
; a value type: 'duration'.

type = %s"bool" / %s"duration" / %s"float" / %s"int" / %s"string" / %s"subcmd" / %s"time"
; a repeat marker: '?', '*', or '+'.
repeat = %s"?" / %s"+" / %s"*"

; unordered bounds with at most one range: '[1..=10, ~"^[0-9]+$", low:1]'.
bounds = %s"[" [ ws ] bounds-body [ ws ] %s"]"
; A range may appear first or after one or more non-range bounds.
bound-separator = 1*( SP / %s"," )
bounds-body = non-range *( bound-separator non-range ) [ bound-separator range *( bound-separator non-range ) ] / range *( bound-separator non-range )
non-range = pattern / enum-entry
; an inclusive range: '0x10..=0xFF'.
range = [ value ] %s"..=" [ value ]
; a regexp string permits regexp escapes such as '\[' in addition to JSON escapes.
pattern = %s"~" quoted-string
; an enum mapping: 'warn:4'.
enum-entry = value [ %s":" value ]
; a default value: '= 1_000'.
default = %s"=" ws value
; one value: '"hello world"'.
value = atom / duration / float / integer / quoted-string
; a quoted string: '"line\n"'. Escapes are validated by the consuming context.
quoted-string = %x22 *( string-char / string-escape ) %x22
; one unescaped string character. The semantic validator requires ']', '^', and '\\' to be escaped
; inside classes, and requires '-' to be escaped unless it is final.
string-char = SP / %x21 / %x23-5B / %x5D-7E / non-ascii
; one escaped printable character. The consuming context decides which escapes are valid.
string-escape = %x5C text-char
; an unquoted value: 'debug-1'.
atom = ( letter / %s"_" ) *( letter / decimal-digit / %s"_" / %s"-" )

; a signed magnitude and unit: '-0xFFm', '2s', '100ms'
duration = %s"0" / [ %s"-" ] uint ( %s"ns" / %s"us" / %s"ms" / %s"s" / %s"m" / %s"h" )


; a decimal floating-point literal in any format: '-1.25', '0.5', '1e3'
float = [ %s"-" ] decimal %s"." decimal [ exponent ] / [ %s"-" ] decimal exponent
exponent = ( %s"e" / %s"E" ) [ %s"+" / %s"-" ] decimal
; an unsigned integer: '0o7_755', 8

; a signed or unsigned integer in any format: '-0b1010_0101' 
integer = [ %s"-" ] uint
uint = decimal / %s"0b" binary / %s"0o" octal / %s"0x" hexadecimal
; base-10 digits: '1_000'.
decimal = decimal-digit *( [ %s"_" ] decimal-digit )
; base-2 digits without '0b': '1010_0101'.
binary = binary-digit *( [ %s"_" ] binary-digit )
; base-8 digits without '0o': '7_755'.
octal = octal-digit *( [ %s"_" ] octal-digit )
; base-16 digits without '0x': 'FF_FF'.
hexadecimal = hex-digit *( [ %s"_" ] hex-digit )

; a comment: '# ignore case'.
comment = %s"#" *( comment-char )
; one printable line character: '#'.
text-char = %x20-7E / non-ascii
comment-char = HTAB / text-char
; one or more spaces, tabs, or commas: ' ,\t '.
ws = 1*( SP / HTAB / %s"," )
; one base-10 digit: '7'.
decimal-digit = %x30-39
; one base-2 digit: '1'.
binary-digit = %'0' 
; one base-8 digit: '7'.
octal-digit = %x30-37
; one ASCII letter: 'Z'.
letter = %x41-5A / %x61-7A
; one base-16 digit: 'F'.
hex-digit = decimal-digit / %x41-46 / %x61-66
; -----------------------------------------------------------------------------
; Bash v2 command grammar
; This section is based on the Bash v2 grammar published at:
; https://cmdse.github.io/pages/appendix/bash-grammar.html
; The command payload after `example` remains lexically opaque to UF; these
; productions document the Bash command language used in that position.
; -----------------------------------------------------------------------------
bash-command = bash-word *( ws bash-word / ws bash-operator / ws bash-redirection )
bash-word = 1*text-char
bash-operator = %s"|" / %s"||" / %s"&&" / %s";" / %s"&" / %s"!"
bash-redirection-operator = %s">" / %s"<" / %s">>" / %s"<<" / %s"<&" / %s">&" / %s"&>" / %s"<>" / %s">|"
bash-redirection = [ decimal-digit ] bash-redirection-operator bash-word

; one non-ASCII code point that is neither whitespace nor a control character. 
; sure is ugly, isn't it?
non-ascii = %xA1-AC / %xAE-377 / %x37A-37F / %x384-38A / %x38C-38C / %x38E-3A1 / %x3A3-52F / %x531-556 / %x559-58A / %x58D-58F / %x591-5C7 / %x5D0-5EA / %x5EF-5F4 / %x606-61B / %x61D-6DC / %x6DE-70D / %x710-74A / %x74D-7B1 / %x7C0-7FA / %x7FD-82D / %x830-83E / %x840-85B / %x85E-85E / %x860-86A / %x870-88F / %x897-8E1 / %x8E3-983 / %x985-98C / %x98F-990 / %x993-9A8 / %x9AA-9B0 / %x9B2-9B2 / %x9B6-9B9 / %x9BC-9C4 / %x9C7-9C8 / %x9CB-9CE / %x9D7-9D7 / %x9DC-9DD / %x9DF-9E3 / %x9E6-9FE / %xA01-A03 / %xA05-A0A / %xA0F-A10 / %xA13-A28 / %xA2A-A30 / %xA32-A33 / %xA35-A36 / %xA38-A39 / %xA3C-A3C / %xA3E-A42 / %xA47-A48 / %xA4B-A4D / %xA51-A51 / %xA59-A5C / %xA5E-A5E / %xA66-A76 / %xA81-A83 / %xA85-A8D / %xA8F-A91 / %xA93-AA8 / %xAAA-AB0 / %xAB2-AB3 / %xAB5-AB9 / %xABC-AC5 / %xAC7-AC9 / %xACB-ACD / %xAD0-AD0 / %xAE0-AE3 / %xAE6-AF1 / %xAF9-AFF / %xB01-B03 / %xB05-B0C / %xB0F-B10 / %xB13-B28 / %xB2A-B30 / %xB32-B33 / %xB35-B39 / %xB3C-B44 / %xB47-B48 / %xB4B-B4D / %xB55-B57 / %xB5C-B5D / %xB5F-B63 / %xB66-B77 / %xB82-B83 / %xB85-B8A / %xB8E-B90 / %xB92-B95 / %xB99-B9A / %xB9C-B9C / %xB9E-B9F / %xBA3-BA4 / %xBA8-BAA / %xBAE-BB9 / %xBBE-BC2 / %xBC6-BC8 / %xBCA-BCD / %xBD0-BD0 / %xBD7-BD7 / %xBE6-BFA / %xC00-C0C / %xC0E-C10 / %xC12-C28 / %xC2A-C39 / %xC3C-C44 / %xC46-C48 / %xC4A-C4D / %xC55-C56 / %xC58-C5A / %xC5C-C5D / %xC60-C63 / %xC66-C6F / %xC77-C8C / %xC8E-C90 / %xC92-CA8 / %xCAA-CB3 / %xCB5-CB9 / %xCBC-CC4 / %xCC6-CC8 / %xCCA-CCD / %xCD5-CD6 / %xCDC-CDE / %xCE0-CE3 / %xCE6-CEF / %xCF1-CF3 / %xD00-D0C / %xD0E-D10 / %xD12-D44 / %xD46-D48 / %xD4A-D4F / %xD54-D63 / %xD66-D7F / %xD81-D83 / %xD85-D96 / %xD9A-DB1 / %xDB3-DBB / %xDBD-DBD / %xDC0-DC6 / %xDCA-DCA / %xDCF-DD4 / %xDD6-DD6 / %xDD8-DDF / %xDE6-DEF / %xDF2-DF4 / %xE01-E3A / %xE3F-E5B / %xE81-E82 / %xE84-E84 / %xE86-E8A / %xE8C-EA3 / %xEA5-EA5 / %xEA7-EBD / %xEC0-EC4 / %xEC6-EC6 / %xEC8-ECE / %xED0-ED9 / %xEDC-EDF / %xF00-F47 / %xF49-F6C / %xF71-F97 / %xF99-FBC / %xFBE-FCC / %xFCE-FDA / %x1000-10C5 / %x10C7-10C7 / %x10CD-10CD / %x10D0-1248 / %x124A-124D / %x1250-1256 / %x1258-1258 / %x125A-125D / %x1260-1288 / %x128A-128D / %x1290-12B0 / %x12B2-12B5 / %x12B8-12BE / %x12C0-12C0 / %x12C2-12C5 / %x12C8-12D6 / %x12D8-1310 / %x1312-1315 / %x1318-135A / %x135D-137C / %x1380-1399 / %x13A0-13F5 / %x13F8-13FD / %x1400-167F / %x1681-169C / %x16A0-16F8 / %x1700-1715 / %x171F-1736 / %x1740-1753 / %x1760-176C / %x176E-1770 / %x1772-1773 / %x1780-17DD / %x17E0-17E9 / %x17F0-17F9 / %x1800-180D / %x180F-1819 / %x1820-1878 / %x1880-18AA / %x18B0-18F5 / %x1900-191E / %x1920-192B / %x1930-193B / %x1940-1940 / %x1944-196D / %x1970-1974 / %x1980-19AB / %x19B0-19C9 / %x19D0-19DA / %x19DE-1A1B / %x1A1E-1A5E / %x1A60-1A7C / %x1A7F-1A89 / %x1A90-1A99 / %x1AA0-1AAD / %x1AB0-1ADD / %x1AE0-1AEB / %x1B00-1B4C / %x1B4E-1BF3 / %x1BFC-1C37 / %x1C3B-1C49 / %x1C4D-1C8A / %x1C90-1CBA / %x1CBD-1CC7 / %x1CD0-1CFA / %x1D00-1F15 / %x1F18-1F1D / %x1F20-1F45 / %x1F48-1F4D / %x1F50-1F57 / %x1F59-1F59 / %x1F5B-1F5B / %x1F5D-1F5D / %x1F5F-1F7D / %x1F80-1FB4 / %x1FB6-1FC4 / %x1FC6-1FD3 / %x1FD6-1FDB / %x1FDD-1FEF / %x1FF2-1FF4 / %x1FF6-1FFE / %x2010-2027 / %x2030-205E / %x2070-2071 / %x2074-208E / %x2090-209C / %x20A0-20C1 / %x20D0-20F0 / %x2100-218B / %x2190-2429 / %x2440-244A / %x2460-2B73 / %x2B76-2CF3 / %x2CF9-2D25 / %x2D27-2D27 / %x2D2D-2D2D / %x2D30-2D67 / %x2D6F-2D70 / %x2D7F-2D96 / %x2DA0-2DA6 / %x2DA8-2DAE / %x2DB0-2DB6 / %x2DB8-2DBE / %x2DC0-2DC6 / %x2DC8-2DCE / %x2DD0-2DD6 / %x2DD8-2DDE / %x2DE0-2E5D / %x2E80-2E99 / %x2E9B-2EF3 / %x2F00-2FD5 / %x2FF0-2FFF / %x3001-303F / %x3041-3096 / %x3099-30FF / %x3105-312F / %x3131-318E / %x3190-31E5 / %x31EF-321E / %x3220-A48C / %xA490-A4C6 / %xA4D0-A62B / %xA640-A6F7 / %xA700-A7DC / %xA7F1-A82C / %xA830-A839 / %xA840-A877 / %xA880-A8C5 / %xA8CE-A8D9 / %xA8E0-A953 / %xA95F-A97C / %xA980-A9CD / %xA9CF-A9D9 / %xA9DE-A9FE / %xAA00-AA36 / %xAA40-AA4D / %xAA50-AA59 / %xAA5C-AAC2 / %xAADB-AAF6 / %xAB01-AB06 / %xAB09-AB0E / %xAB11-AB16 / %xAB20-AB26 / %xAB28-AB2E / %xAB30-AB6B / %xAB70-ABED / %xABF0-ABF9 / %xAC00-D7A3 / %xD7B0-D7C6 / %xD7CB-D7FB / %xF900-FA6D / %xFA70-FAD9 / %xFB00-FB06 / %xFB13-FB17 / %xFB1D-FB36 / %xFB38-FB3C / %xFB3E-FB3E / %xFB40-FB41 / %xFB43-FB44 / %xFB46-FDCF / %xFDF0-FE19 / %xFE20-FE52 / %xFE54-FE66 / %xFE68-FE6B / %xFE70-FE74 / %xFE76-FEFC / %xFF01-FFBE / %xFFC2-FFC7 / %xFFCA-FFCF / %xFFD2-FFD7 / %xFFDA-FFDC / %xFFE0-FFE6 / %xFFE8-FFEE / %xFFFC-FFFD / %x10000-1000B / %x1000D-10026 / %x10028-1003A / %x1003C-1003D / %x1003F-1004D / %x10050-1005D / %x10080-100FA / %x10100-10102 / %x10107-10133 / %x10137-1018E / %x10190-1019C / %x101A0-101A0 / %x101D0-101FD / %x10280-1029C / %x102A0-102D0 / %x102E0-102FB / %x10300-10323 / %x1032D-1034A / %x10350-1037A / %x10380-1039D / %x1039F-103C3 / %x103C8-103D5 / %x10400-1049D / %x104A0-104A9 / %x104B0-104D3 / %x104D8-104FB / %x10500-10527 / %x10530-10563 / %x1056F-1057A / %x1057C-1058A / %x1058C-10592 / %x10594-10595 / %x10597-105A1 / %x105A3-105B1 / %x105B3-105B9 / %x105BB-105BC / %x105C0-105F3 / %x10600-10736 / %x10740-10755 / %x10760-10767 / %x10780-10785 / %x10787-107B0 / %x107B2-107BA / %x10800-10805 / %x10808-10808 / %x1080A-10835 / %x10837-10838 / %x1083C-1083C / %x1083F-10855 / %x10857-1089E / %x108A7-108AF / %x108E0-108F2 / %x108F4-108F5 / %x108FB-1091B / %x1091F-10939 / %x1093F-10959 / %x10980-109B7 / %x109BC-109CF / %x109D2-10A03 / %x10A05-10A06 / %x10A0C-10A13 / %x10A15-10A17 / %x10A19-10A35 / %x10A38-10A3A / %x10A3F-10A48 / %x10A50-10A58 / %x10A60-10A9F / %x10AC0-10AE6 / %x10AEB-10AF6 / %x10B00-10B35 / %x10B39-10B55 / %x10B58-10B72 / %x10B78-10B91 / %x10B99-10B9C / %x10BA9-10BAF / %x10C00-10C48 / %x10C80-10CB2 / %x10CC0-10CF2 / %x10CFA-10D27 / %x10D30-10D39 / %x10D40-10D65 / %x10D69-10D85 / %x10D8E-10D8F / %x10E60-10E7E / %x10E80-10EA9 / %x10EAB-10EAD / %x10EB0-10EB1 / %x10EC2-10EC7 / %x10ED0-10ED8 / %x10EFA-10F27 / %x10F30-10F59 / %x10F70-10F89 / %x10FB0-10FCB / %x10FE0-10FF6 / %x11000-1104D / %x11052-11075 / %x1107F-110BC / %x110BE-110C2 / %x110D0-110E8 / %x110F0-110F9 / %x11100-11134 / %x11136-11147 / %x11150-11176 / %x11180-111DF / %x111E1-111F4 / %x11200-11211 / %x11213-11241 / %x11280-11286 / %x11288-11288 / %x1128A-1128D / %x1128F-1129D / %x1129F-112A9 / %x112B0-112EA / %x112F0-112F9 / %x11300-11303 / %x11305-1130C / %x1130F-11310 / %x11313-11328 / %x1132A-11330 / %x11332-11333 / %x11335-11339 / %x1133B-11344 / %x11347-11348 / %x1134B-1134D / %x11350-11350 / %x11357-11357 / %x1135D-11363 / %x11366-1136C / %x11370-11374 / %x11380-11389 / %x1138B-1138B / %x1138E-1138E / %x11390-113B5 / %x113B7-113C0 / %x113C2-113C2 / %x113C5-113C5 / %x113C7-113CA / %x113CC-113D5 / %x113D7-113D8 / %x113E1-113E2 / %x11400-1145B / %x1145D-11461 / %x11480-114C7 / %x114D0-114D9 / %x11580-115B5 / %x115B8-115DD / %x11600-11644 / %x11650-11659 / %x11660-1166C / %x11680-116B9 / %x116C0-116C9 / %x116D0-116E3 / %x11700-1171A / %x1171D-1172B / %x11730-11746 / %x11800-1183B / %x118A0-118F2 / %x118FF-11906 / %x11909-11909 / %x1190C-11913 / %x11915-11916 / %x11918-11935 / %x11937-11938 / %x1193B-11946 / %x11950-11959 / %x119A0-119A7 / %x119AA-119D7 / %x119DA-119E4 / %x11A00-11A47 / %x11A50-11AA2 / %x11AB0-11AF8 / %x11B00-11B09 / %x11B60-11B67 / %x11BC0-11BE1 / %x11BF0-11BF9 / %x11C00-11C08 / %x11C0A-11C36 / %x11C38-11C45 / %x11C50-11C6C / %x11C70-11C8F / %x11C92-11CA7 / %x11CA9-11CB6 / %x11D00-11D06 / %x11D08-11D09 / %x11D0B-11D36 / %x11D3A-11D3A / %x11D3C-11D3D / %x11D3F-11D47 / %x11D50-11D59 / %x11D60-11D65 / %x11D67-11D68 / %x11D6A-11D8E / %x11D90-11D91 / %x11D93-11D98 / %x11DA0-11DA9 / %x11DB0-11DDB / %x11DE0-11DE9 / %x11EE0-11EF8 / %x11F00-11F10 / %x11F12-11F3A / %x11F3E-11F5A / %x11FB0-11FB0 / %x11FC0-11FF1 / %x11FFF-12399 / %x12400-1246E / %x12470-12474 / %x12480-12543 / %x12F90-12FF2 / %x13000-1342F / %x13440-13455 / %x13460-143FA / %x14400-14646 / %x16100-16139 / %x16800-16A38 / %x16A40-16A5E / %x16A60-16A69 / %x16A6E-16ABE / %x16AC0-16AC9 / %x16AD0-16AED / %x16AF0-16AF5 / %x16B00-16B45 / %x16B50-16B59 / %x16B5B-16B61 / %x16B63-16B77 / %x16B7D-16B8F / %x16D40-16D79 / %x16E40-16E9A / %x16EA0-16EB8 / %x16EBB-16ED3 / %x16F00-16F4A / %x16F4F-16F87 / %x16F8F-16F9F / %x16FE0-16FE4 / %x16FF0-16FF6 / %x17000-18CD5 / %x18CFF-18D1E / %x18D80-18DF2 / %x1AFF0-1AFF3 / %x1AFF5-1AFFB / %x1AFFD-1AFFE / %x1B000-1B122 / %x1B132-1B132 / %x1B150-1B152 / %x1B155-1B155 / %x1B164-1B167 / %x1B170-1B2FB / %x1BC00-1BC6A / %x1BC70-1BC7C / %x1BC80-1BC88 / %x1BC90-1BC99 / %x1BC9C-1BC9F / %x1CC00-1CCFC / %x1CD00-1CEB3 / %x1CEBA-1CED0 / %x1CEE0-1CEF0 / %x1CF00-1CF2D / %x1CF30-1CF46 / %x1CF50-1CFC3 / %x1D000-1D0F5 / %x1D100-1D126 / %x1D129-1D172 / %x1D17B-1D1EA / %x1D200-1D245 / %x1D2C0-1D2D3 / %x1D2E0-1D2F3 / %x1D300-1D356 / %x1D360-1D378 / %x1D400-1D454 / %x1D456-1D49C / %x1D49E-1D49F / %x1D4A2-1D4A2 / %x1D4A5-1D4A6 / %x1D4A9-1D4AC / %x1D4AE-1D4B9 / %x1D4BB-1D4BB / %x1D4BD-1D4C3 / %x1D4C5-1D505 / %x1D507-1D50A / %x1D50D-1D514 / %x1D516-1D51C / %x1D51E-1D539 / %x1D53B-1D53E / %x1D540-1D544 / %x1D546-1D546 / %x1D54A-1D550 / %x1D552-1D6A5 / %x1D6A8-1D7CB / %x1D7CE-1DA8B / %x1DA9B-1DA9F / %x1DAA1-1DAAF / %x1DF00-1DF1E / %x1DF25-1DF2A / %x1E000-1E006 / %x1E008-1E018 / %x1E01B-1E021 / %x1E023-1E024 / %x1E026-1E02A / %x1E030-1E06D / %x1E08F-1E08F / %x1E100-1E12C / %x1E130-1E13D / %x1E140-1E149 / %x1E14E-1E14F / %x1E290-1E2AE / %x1E2C0-1E2F9 / %x1E2FF-1E2FF / %x1E4D0-1E4F9 / %x1E5D0-1E5FA / %x1E5FF-1E5FF / %x1E6C0-1E6DE / %x1E6E0-1E6F5 / %x1E6FE-1E6FF / %x1E7E0-1E7E6 / %x1E7E8-1E7EB / %x1E7ED-1E7EE / %x1E7F0-1E7FE / %x1E800-1E8C4 / %x1E8C7-1E8D6 / %x1E900-1E94B / %x1E950-1E959 / %x1E95E-1E95F / %x1EC71-1ECB4 / %x1ED01-1ED3D / %x1EE00-1EE03 / %x1EE05-1EE1F / %x1EE21-1EE22 / %x1EE24-1EE24 / %x1EE27-1EE27 / %x1EE29-1EE32 / %x1EE34-1EE37 / %x1EE39-1EE39 / %x1EE3B-1EE3B / %x1EE42-1EE42 / %x1EE47-1EE47 / %x1EE49-1EE49 / %x1EE4B-1EE4B / %x1EE4D-1EE4F / %x1EE51-1EE52 / %x1EE54-1EE54 / %x1EE57-1EE57 / %x1EE59-1EE59 / %x1EE5B-1EE5B / %x1EE5D-1EE5D / %x1EE5F-1EE5F / %x1EE61-1EE62 / %x1EE64-1EE64 / %x1EE67-1EE6A / %x1EE6C-1EE72 / %x1EE74-1EE77 / %x1EE79-1EE7C / %x1EE7E-1EE7E / %x1EE80-1EE89 / %x1EE8B-1EE9B / %x1EEA1-1EEA3 / %x1EEA5-1EEA9 / %x1EEAB-1EEBB / %x1EEF0-1EEF1 / %x1F000-1F02B / %x1F030-1F093 / %x1F0A0-1F0AE / %x1F0B1-1F0BF / %x1F0C1-1F0CF / %x1F0D1-1F0F5 / %x1F100-1F1AD / %x1F1E6-1F202 / %x1F210-1F23B / %x1F240-1F248 / %x1F250-1F251 / %x1F260-1F265 / %x1F300-1F6D8 / %x1F6DC-1F6EC / %x1F6F0-1F6FC / %x1F700-1F7D9 / %x1F7E0-1F7EB / %x1F7F0-1F7F0 / %x1F800-1F80B / %x1F810-1F847 / %x1F850-1F859 / %x1F860-1F887 / %x1F890-1F8AD / %x1F8B0-1F8BB / %x1F8C0-1F8C1 / %x1F8D0-1F8D8 / %x1F900-1FA57 / %x1FA60-1FA6D / %x1FA70-1FA7C / %x1FA80-1FA8A / %x1FA8E-1FAC6 / %x1FAC8-1FAC8 / %x1FACD-1FADC / %x1FADF-1FAEA / %x1FAEF-1FAF8 / %x1FB00-1FB92 / %x1FB94-1FBFA / %x20000-2A6DF / %x2A700-2B81D / %x2B820-2CEAD / %x2CEB0-2EBE0 / %x2EBF0-2EE5D / %x2F800-2FA1D / %x30000-3134A / %x31350-33479 / %xE0100-E01EF
9.4. Appendix: Disclosures (LLMs, Generated Code, etc) / Testing & Quality

Render unto man the things which are man's and unto the computer the things which are the computer's.

Norbert Weiner

I take the quality of uf extremely seriously, including ease of use, stability, and performance. It has over 900 tests and 2200 test cases, including 30 benchmarks and over a hundred fuzz tests (so many I had to write a program randfuzzjust to manage them!), but I have a handful of disclosures and caveats.

  • The language design is entirely mine. I came up with the idea and fought out the syntax on a literal chalkboard (not the one pictured: I did that after to look nice).

  • The vast majority of external-facing documentation (.md files like this one) were written by me personally. Documentation in code is more of a split: it is often written by machine over multiple passes with me rejecting insufficiently clear documentation or stepping in for particularly important bits. LLMs sometimes do passes to add in links or fix formatting. Failures in documentation, either because it's missing or it isn't good enough, are my responsibility: let me know about gaps or errors and I'll try and fix it up.

  • Code and its comments are a mixed bag and usually a mix of both. The more comments there are, the more likely it is that I have been the one doing it.

  • A substantial amount of code in the uf toolchain was gehenerated by various LLM models, which greatly accelerated development. In particular, the code in uf borrow, uf init, and ufls, uf mcp, and the autocompletion templates in ac and uf gen, and uf complete are largely the product of LLM-aided development. I plan to mirror this project on codeberg at codeberg.org/efronlicht/uf. I do not think this is in violation of codeberg's LLM guidelines, but if it is, please let me know and I'll move back to gitlab or find somewhere else. -

  • I have tried my best to maintain the simplicity, correctness, quality, and performance of this code, including creating new source-rewriting tools gobackquote, mininline, and gotopsort to try to keep down overall complexity and, of course, getting my hands dirty when necessary. While I am confident in the overall quality of this code, but not all of it is up to "teaching standard".

KNOWN AND ANTICIPATED BUGS:

  • uf gen: while the go target is extensively tested in practice, the other languages aren't (yet). The targets for uf gen are supposed to have byte-identical output and behavior for every combination of (file []byte, args,env []string), and I have a variety of fuzz tests that try to enforce this. They're slow to run, though, so in practice there are likely to be bugs.
  • The uf mcp is extremely new and has not been tested yet in practice.
#!/usr/bin/env bash

# counttests.bash counts the go tests of various kinds in a directory.
echo "pattern files tests"
for f in Test Example Benchmark Fuzz '(Test|Example|Benchmark|Fuzz)'; do
   files=$(rg --files-with-matches "^func $f" | wc -l)
   n=$(rg "^func $f" | wc -l)
   echo "$f $files $n"
done

Test 63 748 Example 25 60 Benchmark 17 33 Fuzz 27 140 (Test|Example|Benchmark|Fuzz) 116 981

  • And over 2200 test cases:
#!/usr/bin/env bash
# countpasses.bash counts the passing go tests that actually run in the directory and its subdirectories
go test -v ./... 2>&1 | rg '--- PASS:' | wc -l
9.5. Appendix: Help Wanted
  • Help configure uf ufls for other editors and tools.

  • Find bugs! A bug submission should contain the following:

    • the contents of your PATH and UFPATH
  • Provide installation scripts and demos for getting them configured.

  • Use it for your own projects: show how it helps (if it does).

9.6. Appendix: About the Author

I'm Efron Licht, owner and principal engineer at Tapir Technology, where we provide software consulting to businesses large and small who need to solve real software problems faster, cheaper, better, (or most importatantly, at all.) I program like crazy and write about programming at eblog.fly.dev. I've written one or two software rants in the classical tradition, a handful of textbook-quality guides ("Backend from the Beginning", "Starting Systems Programming"), an absolute ton about Go, and much more. When I'm not programming or writing, I'm reading a ton of old books (and a handful of new ones), cooking (well), playing pickleball (badly), or fixing up stuff around the house.

Documentation

Overview

Package uf parses, evaluates, and generates uf command specifications.

Index

Examples

Constants

View Source
const (
	// DEC selects decimal output and is also the zero value for numericLiteralFormat.
	DEC = 0b00
	// BIN selects 0b-prefixed output.
	BIN = 0b01
	// OCT selects 0o-prefixed output.
	OCT = 0b10
	// HEX selects 0x-prefixed output.
	HEX = 0b11
	// FMT_MASK extracts DEC, BIN, OCT, or HEX from a format flag set.
	FMT_MASK = 0b11

	// MARK_MASK extracts the temporary MARK_SPECIAL and MARK_DEC state bits.
	MARK_MASK = 0b1100
	// MARK_SPECIAL allows the first 0, 1, or -1 on an all-special line to carry the selected base.
	MARK_SPECIAL = 0b1000
	// MARK_DEC records that the first special value has already carried the selected base.
	MARK_DEC = 0b0100
)

Numeric format flags preserve the spelling base of integer literals when a parsed definition is serialized. DEC, BIN, OCT, and HEX occupy the low two bits and are ordered by precedence: decimal, binary, octal, hex. MARK_SPECIAL and MARK_DEC occupy the high bits used while walking one line; they are not part of the base.

View Source
const DefaultCopyright string = `copyright uf "Efron Licht" 2026 "BSD 3-Clause" "https://gitlab.com/efronlicht/uf/-/blob/master/LICENSE.md"`

DefaultCopyright is the default copyright record for UF documents.

Variables

View Source
var (
	NAMEPAT    = `^(?:` + flagNamePat + `|` + quotedPat + `|` + identPat + `)$`
	SOURCEPAT  = `^(?:flag|arg[1-9]|env)$`
	TYPEPAT    = `^(?:bool|duration|float|int|string|subcmd|time)$`
	REPEATPAT  = `^(?:\?|\+|\*)$`
	BOUNDSPAT  = `^\[(?:\s*` + boundsBodyPat + `\s*)?\]$`
	DEFAULTPAT = `^=\s*` + valuePat + `$`
	COMMENTPAT = `^#.*$`
	APPPAT     = `^app\s+(?:` + appNamePat + `|` + quotedPat + `)$`
	PARENTPAT  = `^parent\s+` + valuePat + `\s+` + valuePat + `$`
	PAT        = "^(?P<source>flag|arg[1-9]|env)\\s+(?P<name>" + flagNamePat + `|` + quotedPat + `|` + identPat + `)` + `\s+(?P<type>bool|duration|float|int|string|subcmd|time)` + `(?:\s*(?P<repeat>\?|\+|\*))?` + `(?:\s+\[(?P<bounds>(?:\s*` + boundsBodyPat + `\s*)?)\])?` + `(?:\s*(?P<default>=\s*` + valuePat + `))?` + `(?:\s*(?P<comment>#.*))?$`
)
View Source
var ErrOrphanComment = errors.New("comment is not attached to a declaration: move it immediately above (or to the right of) an app, env, flag, or arg, or attach it to the app declaration as the app doc comment")

ErrOrphanComment reports a comment that does not belong to a declaration.

Functions

func CheckEvalConfig

func CheckEvalConfig(a Config, arguments, env []string) error

CheckEvalConfig validates arguments and environment values. It may return an error wrapping *ParseError.

Example

ExampleCheckEvalConfig checks a command line before using its values.

cfg := MustParseConfig("app tool\nflag -count int = 1\n")
if err := CheckEvalConfig(cfg, []string{"tool", "-count", "3"}, nil); err != nil {
	panic(err)
}
fmt.Println("arguments accepted")
Output:
arguments accepted

func CheckExampleConfig added in v0.2.0

func CheckExampleConfig(a Config, arguments, env []string) error

CheckExampleConfig validates an example while allowing required environment values to be inherited by the shell.

func CmpLexish added in v0.5.1

func CmpLexish(d, o string) int

CmpLexish compares two strings lexicographically, ignoring leading hyphens and case. On ties, the strings are compared using their original byte values.

func DeclarationSyntaxError

func DeclarationSyntaxError(line string) (int, error, bool)

DeclarationSyntaxError reports the first grammar error without semantic validation.

Example

ExampleDeclarationSyntaxError locates a malformed declaration.

offset, err, ok := DeclarationSyntaxError("flag -count")
fmt.Println("syntax error:", ok)
fmt.Println("offset:", offset)
fmt.Println("message:", err)
Output:
syntax error: true
offset: 11
message: flag requires a type after the name; expected one of bool|duration|float|int|string|subcmd|time

func EvalConfig

func EvalConfig(a Config, arguments, env []string) (vals map[string]any, src map[string]Source, err error)

EvalConfig evaluates arguments and environment values. It may return an error wrapping *ParseError.

Example

ExampleEvalConfig evaluates flags and positional arguments into typed values.

cfg := MustParseConfig("app tool\nflag -count int = 1\narg1 name string\n")
values, _, err := EvalConfig(cfg, []string{"tool", "-count", "3", "Ada"}, nil)
if err != nil {
	panic(err)
}
fmt.Println("count:", values["-count"])
fmt.Println("name:", values["name"])
Output:
count: 3
name: Ada

func EvalConfigPrefix

func EvalConfigPrefix(a Config, arguments, env []string) (vals map[string]any, src map[string]Source, remainder []string, err error)

EvalConfigPrefix evaluates a command through its terminal subcmd positional and returns the remaining argv. The subcmd value is the canonical identity from an identity-to-spelling bound such as [uf-borrow: borrow].

func EvalExampleConfigPrefix added in v0.2.0

func EvalExampleConfigPrefix(a Config, arguments, env []string) (vals map[string]any, src map[string]Source, remainder []string, err error)

EvalExampleConfigPrefix evaluates a subcommand example while allowing required environment values to be inherited by the shell.

func EvalOne

func EvalOne(b Bounds, name, def string, values ...string) (v any, err error)

EvalOne validates and converts values according to bounds. It returns validation errors without source locations.

Example

ExampleEvalOne parses one value using explicit bounds.

value, err := EvalOne(Bounds{Type: INT}, "0", "42")
if err != nil {
	panic(err)
}
fmt.Println("value:", value)
Output:
value: 42

func NeighborTableBytes

func NeighborTableBytes() string

NeighborTableBytes returns the keyboard-neighbor table in generated-parser form.

func ParseConfigWithLocations

func ParseConfigWithLocations(raw string) (Config, DefinitionLocations, error)

ParseConfigWithLocations parses a configuration and returns source locations for its declarations.

Example

ExampleParseConfigWithLocations keeps source locations for later diagnostics.

cfg, locations, err := ParseConfigWithLocations("app tool\nflag -count int = 1\n")
if err != nil {
	panic(err)
}
location := locations[DefinitionKey{Source: FLAG, Name: "-count"}]
fmt.Println("application:", cfg.App)
fmt.Println("flag line:", location.LineTable[0]+1)
Output:
application: tool
flag line: 1

func ParseErrorf added in v0.1.2

func ParseErrorf(format string, args ...any) error

ParseErrorf formats an error and moves a nested parse location to the front.

Types

type Bounds

type Bounds struct {
	Enum    map[string]string `json:"enum,omitempty,omitzero"`    // choices like [a b c] or [k0:v0 k1:v1]
	Max     string            `json:"max,omitempty,omitzero"`     // if non-empty, must parse as Type: [[MIN]..=[MAX]]
	Min     string            `json:"min,omitempty,omitzero"`     // if non-empty, must parse as Type:
	Pattern string            `json:"pattern,omitempty,omitzero"` // if non-empty, an alternative to enum and range bounds: [~PAT]
	Repeat  Repeat            `json:"repeat,omitempty,omitzero"`  // specifies how many times the value can be repeated: 0 (exactly once), '*' (many), '+' (at least one), '?' (optional)
	Type    VarType           `json:"type,omitempty,omitzero"`    // bool | duration | float | int | string | subcmd | time
}

Bounds represents the constraints that can be applied to a value. In UF form, they look like this: [<bounds go here>] All components are optional.

func (Bounds) AppendText

func (b Bounds) AppendText(dst []byte) ([]byte, error)

AppendText appends bounds in .uf syntax.

func (Bounds) Equal

func (b Bounds) Equal(c Bounds) bool

Bounds are equal if all of their fields are equal, recursively checking nested structures, slices, etc.

func (*Bounds) Validate

func (b *Bounds) Validate() error

Validate checks a bound's type, repeat mode, and limits.

type Config

type Config struct {
	App         string      // Name of the application: `app myprogram`
	AppComment  string      // Comment for the application, typically describing its purpose.
	Copyrights  []Copyright // Copyright records for the application.
	Environment []Def       // Environment variable definitions for the application, as sorted key-value pairs.
	Examples    []Example   // Example command-line invocations for the application
	Flags       []Def       // Flag definitions for the application, as sorted-by-key key-value pairs.
	Parent      Parent      // Parent command and alias for the application, if any.
	Positional  []Def       // Positional argument definitions for the application, as sorted-by-key key-value pairs.
	Shebang     string      // Shebang line for the application, if any. It should almost always be #!/usr/bin/env uf.
	Subcmds     []string    // List of subcmds for the application: if len > 0, then the trailing positional arguments (after len(c.Positional)-1) are reserved for the subcmd.
}

Config represents a fully parsed and validated UF configuration file.

ParseConfig("app grep\nflag -r bool") -> Config{App: "grep", Flags: []Def{...}}

func MustParseConfig

func MustParseConfig(raw string) Config

MustParseConfig parses a .uf document and panics if it is invalid.

Example

ExampleMustParseConfig parses a known-valid declaration without manual error handling.

cfg := MustParseConfig("app copy\narg1 source string\n")
fmt.Println("application:", cfg.App)
fmt.Println("argument:", cfg.Positional[0].Name)
Output:
application: copy
argument: source

func ParseConfig

func ParseConfig(raw string) (Config, error)

ParseConfig parses and validates a complete UF configuration.

ParseConfig("app grep\n") -> Config{App: "grep"}
Example

ExampleParseConfig returns a config and an error for a declaration.

cfg, err := ParseConfig("app grep\nflag -ignore-case bool = false\n")
if err != nil {
	panic(err)
}
fmt.Println("application:", cfg.App)
fmt.Println("flag:", cfg.Flags[0].Name)
Output:
application: grep
flag: -ignore-case

func ParseConfigFile

func ParseConfigFile(filename, raw string) (Config, error)

ParseConfigFile parses and validates a UF configuration while retaining filename context in errors.

func (*Config) AppendDefs

func (c *Config) AppendDefs(dst []Def) []Def

AppendDefs appends all definitions from c and sorts the result by name.

func (Config) AppendText

func (c Config) AppendText(dst []byte) ([]byte, error)

AppendText appends the textual representation of the Config to dst and returns the resulting slice and any error encountered. This is the underlying implementation used by WriteTo and String()

Example

ExampleConfig_AppendText serializes a config back to UF syntax.

cfg := MustParseConfig("app copy\nflag -verbose bool = false\n")
text, err := cfg.AppendText(nil)
if err != nil {
	panic(err)
}
fmt.Print(string(text))
Output:
app copy

copyright uf "Efron Licht" 2026 "BSD 3-Clause" "https://gitlab.com/efronlicht/uf/-/blob/master/LICENSE.md"

flag -verbose bool = false

func (Config) Equal

func (c Config) Equal(d Config) bool

Configs are equal if all of their fields are equal, recursively checking nested structures, slices, etc.

func (Config) MarshalJSONTo

func (c Config) MarshalJSONTo(enc *jsontext.Encoder) error

MarshalJSONTo encodes the full configuration as JSON.

func (Config) RegisterFlagSet

func (c Config) RegisterFlagSet(fs *flag.FlagSet) error

RegisterFlagSet adds c's flags to fs.

-verbose -> verbose in fs
Example

ExampleConfig_RegisterFlagSet shows registering a config with a flag.FlagSet. The generated usage text includes both flags and positional arguments from the spec.

const spec = `
app copy
flag -count int [1..=10] = 1 # number of items
flag -verbose bool = false # enable logs
arg1 input string
arg2 output string
`
cfg := MustParseConfig(spec)
fs := flag.NewFlagSet("copy", flag.ContinueOnError)
if err := cfg.RegisterFlagSet(fs); err != nil {
	panic(err)
}
fs.SetOutput(os.Stdout)
fs.Usage()
Output:
copy [-count int] [-verbose] input output
Usage of copy:
  -count value
    	number of items (default 1)
  -verbose
    	enable logs (default false)

func (Config) String

func (c Config) String() string

String returns the UF serialization of the complete configuration.

func (Config) Synopsis

func (c Config) Synopsis() string

Synopsis returns a one-line summary of the configuration, like "command [flags] <args>". Subcommand positionals list their accepted spellings as alternatives.

cfg := Config{
	App: "mygrep",
	Flags: []Def{
		{Name: "-verbose", Type: BOOL, Default: "false", Comment: "enable verbose logging", Source: FLAG},
		{Name: "-output", Type: STRING, Default: "out", Source: FLAG}, {Name: "-expression", Type: STRING, Source: FLAG, Repeat: REPEAT_AT_LEAST_ONE},
		{Name: "-include", Type: STRING, Source: FLAG, Repeat: REPEAT_MANY}}, Positional: []Def{{Name: "pattern", Type: STRING, Source: ARG1},
		{Name: "file", Type: STRING, Source: ARG1, Repeat: REPEAT_MANY},
	},
}

fmt.Println(cfg.Synopsis())
// Output: mygrep -expression string [-expression string ...] [-include string ...] [-output string] [-verbose] pattern [file ...]
Example

ExampleConfig_Synopsis shows the synopsis generated for a config declaration. Repeated flags and positional arguments are marked in the synopsis with their grammar.

cfg := Config{App: "mygrep", Flags: []Def{{Name: "-verbose", Type: BOOL, Default: "false", Comment: "enable verbose logging", Source: FLAG}, {Name: "-output", Type: STRING, Default: "out", Source: FLAG}, {Name: "-expression", Type: STRING, Source: FLAG, Repeat: REPEAT_AT_LEAST_ONE}, {Name: "-include", Type: STRING, Source: FLAG, Repeat: REPEAT_MANY}}, Positional: []Def{{Name: "pattern", Type: STRING, Source: ARG1}, {Name: "file", Type: STRING, Source: ARG2, Repeat: REPEAT_MANY}}}
fmt.Println(cfg.Synopsis())
Output:
mygrep -expression string [-expression string ...] [-include string ...] [-output string] [-verbose] pattern [file ...]

func (*Config) UnmarshalJSONFrom

func (c *Config) UnmarshalJSONFrom(dec *jsontext.Decoder) error

UnmarshalJSONFrom decodes a compact JSON configuration into a Config.

func (*Config) UnmarshalText

func (c *Config) UnmarshalText(b []byte) error

UnmarshalText parses a complete UF configuration from text.

func (Config) Usage

func (c Config) Usage(name string) string

Usage returns a command-line usage line for the configuration.

Example

ExampleConfig_Usage renders a command's usage text from its declarations.

cfg := MustParseConfig("app copy\nflag -verbose bool = false\narg1 source string\n")
fmt.Print(cfg.Usage("copy"))
Output:
copy [-verbose=false] source

func (Config) WrappedSynopsis

func (c Config) WrappedSynopsis(linewidth int) string

WrappedSynopsis is as Synopsis, but wraps lines to the given width.

type Copyright struct {
	Name    string   `json:"name,omitempty,omitzero"`    // name of the copyrighted work.
	Holder  string   `json:"holder,omitempty,omitzero"`  // copyright holder.
	Year    int      `json:"year,omitempty,omitzero"`    // copyright year.
	License string   `json:"license,omitempty,omitzero"` // license name.
	Link    *url.URL `json:"link,omitempty,omitzero"`    // license or project URL.
	Comment string   `json:"comment,omitempty,omitzero"` // human-readable note.
}

Copyright records one copyright holder and license for an application.

func RequiredCopyright

func RequiredCopyright() (cr Copyright)

RequiredCopyright returns the copyright record every generated UF document must contain.

func (Copyright) AppendText

func (c Copyright) AppendText(dst []byte) ([]byte, error)

AppendText appends c as a copyright declaration in UF syntax: "copyright <name> <holder> <year> <license> [<link>] # <comment>"

func (Copyright) Equal

func (c Copyright) Equal(o Copyright) bool

Equal reports whether two Copyright records are equal.

func (Copyright) MarshalJSONTo

func (c Copyright) MarshalJSONTo(enc *jsontext.Encoder) error

MarshalJSONTo encodes a copyright through the package's compact JSON representation.

func (*Copyright) UnmarshalJSONFrom

func (c *Copyright) UnmarshalJSONFrom(dec *jsontext.Decoder) error

UnmarshalJSONFrom decodes one compact JSON copyright.

func (*Copyright) UnmarshalText

func (c *Copyright) UnmarshalText(b []byte) error

UnmarshalText parses one copyright declaration.

type DeclarationScan

type DeclarationScan struct {
	Spans        []DeclarationSpan // source spans in line order.
	InvalidStart int               // first invalid byte, or -1 when valid.
	CommentStart int               // `#` byte, or -1 when there is no comment.
}

DeclarationScan contains source-preserving declaration spans and recovery metadata.

func ScanDeclarationLine

func ScanDeclarationLine(line string, dst []DeclarationSpan) DeclarationScan

ScanDeclarationLine maps `flag -v bool [1..=3]` to reusable byte spans. InvalidStart and CommentStart are -1 when no corresponding boundary exists.

type DeclarationSpan

type DeclarationSpan struct {
	Start  int                 // first byte, such as 5 for the name in `flag -v bool`.
	End    int                 // byte after the span.
	Role   DeclarationSpanRole // syntax role, such as DeclarationRoleName.
	Quoted bool                // whether the span includes quotes, such as `"-#"`.
	Quote  byte                // opening quote byte, or zero when unquoted.
}

DeclarationSpan is a byte range and structural role within one declaration line.

type DeclarationSpanRole

type DeclarationSpanRole uint8

DeclarationSpanRole describes the syntactic role of one declaration span.

const (
	// DeclarationRoleUnknown marks a span without a recognized role.
	DeclarationRoleUnknown DeclarationSpanRole = iota
	// DeclarationRoleSource marks `flag`, `env`, or `arg1` through `arg9`.
	DeclarationRoleSource
	// DeclarationRoleName marks a declaration name such as `-verbose`.
	DeclarationRoleName
	// DeclarationRoleType marks a type such as `string`.
	DeclarationRoleType
	// DeclarationRoleRepeat marks `?`, `*`, or `+`.
	DeclarationRoleRepeat
	// DeclarationRoleOperator marks syntax such as `[`, `=`, or `..=`.
	DeclarationRoleOperator
	// DeclarationRoleBoundValue marks values inside `[ ... ]`.
	DeclarationRoleBoundValue
	// DeclarationRolePatternValue marks a pattern such as `"[a-z]+"`.
	DeclarationRolePatternValue
	// DeclarationRoleDefaultValue marks text after a declaration default `=`.
	DeclarationRoleDefaultValue
)

type Def

type Def struct {
	Name        string                             `json:"name,omitempty,omitzero"`    // flag, environment, or positional name.
	Comment     string                             `json:"comment,omitempty,omitzero"` // documentation shown for the declaration.
	Default     string                             `json:"default,omitempty,omitzero"` // default value when one is set.
	EmptyString bool                               `json:"-"`                          // whether an explicit empty string is the default.
	Source      `json:"source,omitempty,omitzero"` // declaration source such as flag or arg1.
	Bounds      `json:"embed"`                     // type, repeat mode, and value constraints.
	// contains filtered or unexported fields
}

Def describes one flag, environment variable, or positional argument declaration.

ParseDef("flag -n int [1..=10] = 3") -> Def{Name: "-n", Default: "3", ...}

func ParseAppendDefs added in v0.3.0

func ParseAppendDefs(dst []Def, line string, comments []string) ([]Def, int, error)

ParseAppendDefs parses one declaration and appends it to dst.

ParseAppendDefs(nil, "flag -n int", nil) -> []Def{
	{Name: "-n", Source: FLAG, Bounds: Bounds{Type: INT}},
}
Example

ExampleParseAppendDefs adds a declaration to an existing list.

defs, offset, err := ParseAppendDefs(nil, "flag -verbose bool = false", nil)
if err != nil {
	panic(err)
}
fmt.Println("declarations:", len(defs))
fmt.Println("offset:", offset)
Output:
declarations: 1
offset: 0

func ParseDef

func ParseDef(raw string) (Def, error)

ParseDef parses exactly one flag, environment, or positional declaration.

ParseDef("flag -n int") -> Def{Name: "-n", Source: FLAG, Bounds: Bounds{Type: INT}}
Example

ExampleParseDef parses one flag declaration.

defs, err := ParseDefs("flag -count int = 1")
if err != nil {
	panic(err)
}
fmt.Println("name:", defs[0].Name)
fmt.Println("type:", defs[0].Bounds.Type)
Output:
name: -count
type: int

func ParseDefs added in v0.3.0

func ParseDefs(raw string) ([]Def, error)

ParseDefs parses one or more flag, environment, or positional declarations.

ParseDefs("flag -n int\nflag -v bool = false") -> []Def{
	{Name: "-n", Source: FLAG, Bounds: Bounds{Type: INT}},
	{Name: "-v", Source: FLAG, Default: "false", Bounds: Bounds{Type: BOOL}},
}

func (Def) AppendText

func (a Def) AppendText(dst []byte) ([]byte, error)

AppendText serializes a definition in .uf syntax.

Def{Name: "-n", Source: FLAG, Bounds: Bounds{Type: INT}} -> `flag -n int`
Example

ExampleDef_AppendText serializes one declaration.

def := Def{Name: "-count", Type: INT, Default: "1", Source: FLAG}
text, err := def.AppendText(nil)
if err != nil {
	panic(err)
}
fmt.Print(string(text))
Output:
flag -count int = 1

func (Def) AppendTextWithIndices

func (a Def) AppendTextWithIndices(dst []byte) ([]byte, DefSpans, error)

AppendTextWithIndices serializes a definition such as `flag -n int` and records half-open byte spans in DefSpans so an editor can select each emitted field.

func (Def) Equal

func (d Def) Equal(e Def) bool

Defs are equal if all of their fields are equal.

func (Def) MarshalJSONTo

func (a Def) MarshalJSONTo(enc *jsontext.Encoder) error

MarshalJSONTo encodes a definition as JSON with the `bounds` embedded.

func (Def) String

func (a Def) String() string

String returns the UF serialization of one definition.

func (*Def) UnmarshalJSONFrom

func (a *Def) UnmarshalJSONFrom(dec *jsontext.Decoder) error

UnmarshalJSONFrom decodes one compact JSON definition into a Def.

func (*Def) UnmarshalText

func (a *Def) UnmarshalText(b []byte) error

UnmarshalText parses one definition from UF text. Just delegates to ParseDef.

type DefSpans

type DefSpans struct {
	Source  TextSpan // declaration source such as flag or arg1.
	Name    TextSpan // flag, environment, or positional name.
	Type    TextSpan // declared value type.
	Bounds  TextSpan // repeat marker and bound expression.
	Default TextSpan // default value after '='.
	Comment TextSpan // trailing or preceding documentation comment.
}

DefSpans represents where the components of a definition are located within the source file.

ScanDeclarationLine("flag -n int", nil) -> DeclarationScan{Spans: []DeclarationSpan{...}}

type DefinitionKey

type DefinitionKey = parseerror.DefinitionKey

type DefinitionLocations

type DefinitionLocations = map[DefinitionKey]parseerror.Location // maps definition keys to their locations in the source file

type ErrorChild added in v0.2.0

type ErrorChild = parseerror.Child // Child associates an error with an offset relative to its parent parse error.

type Example

type Example struct {
	Description string   `json:"description,omitempty,omitzero"` // human-readable description of the example
	Raw         string   `json:"raw,omitempty,omitzero"`         // raw command-line string, held on to if the example can't be fully parsed via known Args and Env
	Env         []string `json:"env,omitempty,omitzero"`         // Fully parsed command-line configuration including shebang, app comment, positional arguments, flags, and environment variables.
	Args        []string `json:"args,omitempty,omitzero"`        // example positional arguments or flags for the application
}

A single example command-line invocation for the application.

func NormalizeExample added in v0.2.0

func NormalizeExample(a Config, example Example) Example

NormalizeExample applies the same environment and flag ordering used by evaluator help. It handles each invocation before a shell separator independently and leaves raw examples unchanged.

func NormalizeExampleWithSubcommands added in v0.2.0

func NormalizeExampleWithSubcommands(a Config, example Example, resolve func(string) (Config, bool)) Example

NormalizeExampleWithSubcommands normalizes nested command paths using resolved child configs. The resolver receives a canonical subcommand identity from a bounds map.

func (Example) AppendText

func (e Example) AppendText(dst []byte) ([]byte, error)

AppendText appends an example in .uf syntax.

func (*Example) ClearRaw added in v0.2.0

func (e *Example) ClearRaw()

ClearRaw removes the generated raw marker while preserving the rest of the comment.

func (Example) Equal

func (e Example) Equal(f Example) bool

Examples are equal if all of their fields are equal.

func (Example) IsRaw added in v0.2.0

func (e Example) IsRaw() bool

IsRaw reports whether the example is opaque documentation rather than a checked invocation.

func (*Example) MarkRaw added in v0.2.0

func (e *Example) MarkRaw()

MarkRaw adds the raw marker to the example comment without changing its command arguments.

type LanguageFragment added in v0.2.0

type LanguageFragment struct {
	// contains filtered or unexported fields
}

LanguageFragment stores plain and highlighted text produced for one language.

type License

type License struct {
	What    string   `json:"what,omitempty,omitzero"`    // what the license is for
	Name    string   `json:"name,omitempty,omitzero"`    // name of the licenseholder
	Year    int      `json:"year,omitempty,omitzero"`    // year of the license
	Ref     string   `json:"text,omitempty,omitzero"`    // human-readable text of the license: keep it short.
	WhatURL *url.URL `json:"url,omitempty,omitzero"`     // optional: specific URL for the license: like https://gitlab.com/efronlicht/uf/-/blob/master/LICENSE.md
	RefURL  *url.URL `json:"ref_url,omitempty,omitzero"` // optional: reference URL for the license: i.e, https://opensource.org/licenses/BSD-3-Clause for the BSD 3-Clause License
}

License represents the license information for the application.

type Location added in v0.2.0

type Location = parseerror.Location

Location identifies a byte offset in source text

type Parent

type Parent struct {
	Name  string `json:"name,omitempty,omitzero"`  // parent command name.
	Alias string `json:"alias,omitempty,omitzero"` // alias used to invoke the parent.
}

Parent identifies the command and alias that invoke an application as a subcmd.

type ParseError

type ParseError = parseerror.Error // ParseError associates an error with a byte offset in source text.

type PositionalRepeatError

type PositionalRepeatError struct {
	Name   string // the name of the positional argument
	Source Source // the source of the positional argument (ARG1, ..., ARG9)
	Repeat Repeat // the repeat constraint for the positional argument (0, '*', '+', '?')
}

PositionalRepeatError reports a * or + repeat on a nonterminal positional argument.

func (*PositionalRepeatError) Error

func (e *PositionalRepeatError) Error() string

Error describes an invalid repeat marker on a positional argument.

type Repeat

type Repeat byte

Repeat controls how many values a declaration accepts: exactly one, ?, *, or +.

string* -> REPEAT_MANY
const (
	// REPEAT_EXACTLY_ONCE is the zero value and requires one value.
	REPEAT_EXACTLY_ONCE Repeat = 0
	// REPEAT_MANY allows zero or more values.
	REPEAT_MANY Repeat = '*'
	// REPEAT_AT_LEAST_ONE requires one or more values.
	REPEAT_AT_LEAST_ONE Repeat = '+'
	// REPEAT_OPTIONAL allows zero or one value.
	REPEAT_OPTIONAL Repeat = '?'
)

type Source

type Source = string

Source identifies whether a declaration is a flag, environment variable, or positional argument.

const (
	ARG0 Source = "arg0"
	ARG1 Source = "arg1"
	ARG2 Source = "arg2"
	ARG3 Source = "arg3"
	ARG4 Source = "arg4"
	ARG5 Source = "arg5"
	ARG6 Source = "arg6"
	ARG7 Source = "arg7"
	ARG8 Source = "arg8"
	ARG9 Source = "arg9"
	ENV  Source = "env"
	FLAG Source = "flag"
)

flag, env, arg1..=arg9 begin variable declarations

type SubcommandDeclarationError

type SubcommandDeclarationError struct {
	Name   string // the name of the subcommand
	Source Source // the source of the subcommand (ARG1, ..., ARG9)
	Rule   string // the rule that was violated for the subcommand declaration
}

SubcommandDeclarationError reports an invalid subcommand positional declaration.

func (*SubcommandDeclarationError) Error

Error formats the violated rule for an invalid subcommand declaration.

type TextSpan

type TextSpan struct {
	Start, End int // byte offsets: start <= end
	Valid      bool
}

TextSpan represents a span of text within a source file, including its start and end positions.

type Token

type Token struct {
	Start, End int       // byte range in the source text.
	TokenType  TokenType // lexical category.
}

Token is one lexical item and its byte range in the source.

Lex("flag") -> Token{Start: 0, End: 4, ...}

func AppendLex

func AppendLex(tokens []Token, raw string) ([]Token, error)

AppendLex appends the lexical prefix of raw to tokens and returns the first lexical error.

func Lex

func Lex(raw string) ([]Token, error)

Lex returns the lexical prefix even when raw contains an invalid or unterminated token.

Example

ExampleLex returns the lexical prefix of a declaration.

raw := "flag -count int = 2 # some comment"
tokens, err := Lex(raw)
if err != nil {
	panic(err)
}
for _, token := range tokens {
	fmt.Printf("%d %d %c %q\n", token.Start, token.End, rune(token.TokenType), raw[token.Start:token.End])
}
Output:
	0 4 s "flag"
5 11 s "-count"
12 15 s "int"
16 17 = "="
18 19 s "2"
20 21 # "#"
22 26 c "some"
27 34 c "comment"

type TokenType

type TokenType int

TokenType identifies one lexical item in UF syntax.

const (
	T_UNKNOWN             TokenType = 0
	T_COLON               TokenType = ':'
	T_COMMENT_CONTENTS    TokenType = 'c' // after '#', before '\n'
	T_COMMENT_START       TokenType = '#' // unquoted '#' starts a comment
	T_EQUALS              TokenType = '=' // unquoted '=' starts a default
	T_NEWLINE             TokenType = 'n' // newline character '\n'
	T_PATTERN_START       TokenType = '~' // unquoted '~' starts a pattern in a bounds
	T_QUOTE_START         TokenType = 'q' // unquoted '"' starts a quoted string
	T_QUOTED_STRING       TokenType = 'S' // contents of a quoted string
	T_EMPTY_STRING        TokenType = 'e' // empty string literal ""
	T_RANGE               TokenType = '.' // range marker in bounds
	T_REPEAT_PLUS         TokenType = '+' // repetition marker '+' (one or more)
	T_REPEAT_STAR         TokenType = '*' // repetition marker '*'  (zero or more)
	T_REPEAT_OPTIONAL     TokenType = '?' // repetition marker '?' (zero or one)
	T_SQUAREBRACKET_END   TokenType = ']' // closing square bracket (ends bounds or subcommand)
	T_SQUAREBRACKET_START TokenType = '[' // opening square bracket (starts bounds or subcommand)
	T_UNQUOTED_STRING     TokenType = 's' // unquoted string (declaration kind, name, or value)
)

type VarType

type VarType string

VarType identifies the literal type accepted by a declaration.

const (
	BOOL     VarType = "bool"
	DURATION VarType = "duration"
	FLOAT    VarType = "float"
	INT      VarType = "int"
	STRING   VarType = "string"
	SUBCMD   VarType = "subcmd"
	TIME     VarType = "time"
)

Directories

Path Synopsis
Package ac generates shell argument-completion scripts.
Package ac generates shell argument-completion scripts.
cmd
cookreadme command
incrversion command
incrversion increments the version in a JSON object.
incrversion increments the version in a JSON object.
juf command
juf is a command-line utility for evaluating uf configurations in JSON format.
juf is a command-line utility for evaluating uf configurations in JSON format.
randfuzz command
Command randfuzz generates randomized fuzz inputs for uf parsers.
Command randfuzz generates randomized fuzz inputs for uf parsers.
uf command
Command uf is the toolchain for managing and executing uf subcmds, including: // try `uf list` to see available subcmds, then uf <subcmd> -h for help about a specific subcmd.
Command uf is the toolchain for managing and executing uf subcmds, including: // try `uf list` to see available subcmds, then uf <subcmd> -h for help about a specific subcmd.
ufborrow command
ufclean command
ufcomplete command
ufcomplete/ufcompletecli
Command ufcomplete generates standalone shell completion entries from .uf files.
Command ufcomplete generates standalone shell completion entries from .uf files.
ufexplain command
uffmt command
ufgen command
ufgen-bootstrap command
Command ufgen-bootstrap regenerates parser and example sources without the generated ufgen CLI.
Command ufgen-bootstrap regenerates parser and example sources without the generated ufgen CLI.
ufgen/examples/go command
Command grep is a generated example command for searching files.
Command grep is a generated example command for searching files.
ufgen/ufgencli
Command ufgen generates source code from uf command specifications.
Command ufgen generates source code from uf command specifications.
ufgrammargen command
Command ufgrammargen generates uf grammar source files.
Command ufgrammargen generates uf grammar source files.
ufimport command
ufinit command
ufinstalltldr command
uflend command
ufls command
ufmcp command
Command ufmcp runs the UF MCP server as a standalone stdio process.
Command ufmcp runs the UF MCP server as a standalone stdio process.
ufneighborsgen command
Command ufneighborsgen generates neighboring parser states.
Command ufneighborsgen generates neighboring parser states.
ufsyntax command
ufsyntax/ufsyntaxcli
Command ufsyntax generates the Sublime syntax definition for .uf files.
Command ufsyntax generates the Sublime syntax definition for .uf files.
Package highlight applies the embedded uf syntax with Chroma.
Package highlight applies the embedded uf syntax with Chroma.
internal
Package man renders uf command specifications as man pages.
Package man renders uf command specifications as man pages.
Package sublime generates Sublime Text syntax definitions from ABNF and EBNF grammars.
Package sublime generates Sublime Text syntax definitions from ABNF and EBNF grammars.
Package syntax embeds the generated uf syntax definition.
Package syntax embeds the generated uf syntax definition.
Package ufexplain explains uf command specifications.
Package ufexplain explains uf command specifications.
Package ufgen generates source code from uf configuration files.
Package ufgen generates source code from uf configuration files.
Package ufls implements the uf language server used by the VS Code extension.
Package ufls implements the uf language server used by the VS Code extension.

Jump to

Keyboard shortcuts

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