Skip to main content

Module semantics

Module semantics 

Source
Expand description

The semantics of the native command line that its declaration cannot carry.

clap declares everything about shape: the commands, their arguments, defaults, value sets, help. It cannot declare what running one does to the repository, whether it holds a terminal, or where the values of <BRANCH> come from. Those are decisions, and this is where they are made — once, beside the declaration, in the same crate, never again per surface.

§Why this is not a second registry

Two properties keep it from becoming one:

  • The default is the answer for most commands. This executable is read-only and non-interactive; Semantics::DEFAULT says so, and a command that is nothing more than that appears nowhere below. Only a command that departs from the default is named — which is exactly the information nothing else holds.
  • Completeness is enforced in both directions. validate fails when an entry names a command that does not exist (a rename that left this file behind) and when a command’s effect could not be decided. The table cannot silently go stale, which is the property that distinguishes a declaration from a mirror.

This is the same arrangement the examples beside the command line already use, and it is checked by the same kind of test.

Structs§

Semantics
What a command does, beyond what its declaration says.
ValueBinding
Where the values of an argument come from, when the type the declaration erased is one this repository has a registry for.
WorkflowAlias
A name the workflow runner answered to before the bridge was derived, kept so that no recipe a person or a script used disappears.

Constants§

SEMANTICS
Every command that departs from Semantics::DEFAULT.
VALUE_BINDINGS
Every argument whose values a registry here knows.
WORKFLOW_ALIASES
Every workflow name that predates the generated bridge.

Functions§

binding
Where an argument’s values come from, when a binding names it.
of
The semantics of one command: the most specific entry that names it, or the most specific entry that names a prefix of it, or the default.
secrecy
How openly an argument’s value may be handled, inferred from what it is called.
unused
Every entry names a command that exists.
unused_aliases
Every alias that names a command the graph does not carry.