Expand description
The banner: a snapshot rendered for a person at a terminal.
This is a view and nothing else. It discovers nothing, reads no file, runs no command
and holds no fact of its own — every number, name, URL and command in it comes out of
the super::RepositoryEnvironment it was handed. That is what keeps the thing a
person sees on cd and the thing GET /api/v1/environment returns from ever
disagreeing.
§What it refuses to do
- Print anything it was not given. A count that was not resolved is shown as
—, never as0. - Print anything unsanitised. Every value goes through
super::text::sanitise; a branch name is arbitrary text chosen by whoever made the branch. - Measure in bytes. Every column is
super::text::width, so a box does not fall apart on a name that is not ASCII. - Colour when it was not asked to.
NO_COLOR, a pipe, andCIeach turn it off. - Fail. A render error would take the shell down with it, so there is no path here that can produce one.
Structs§
- Presentation
- What the terminal on the other end can take.
Enums§
- Banner
Mode - How much of a snapshot to show.
Constants§
- MAX_
WIDTH - The widest a banner is drawn, however wide the terminal is. A box that stretches across a 200-column window is harder to read than one that does not.
- MIN_
BOX_ WIDTH - The narrowest terminal the box is drawn in; below it, the plain two-line form is used whatever the mode, because a box that does not fit is worse than no box.
Functions§
- banner
- Render a banner, or nothing when the mode says nothing.