Class Banner
- All Implemented Interfaces:
picocli.CommandLine.IHelpSectionRenderer
CommandLine.Model.UsageMessageSpec.SECTION_KEY_HEADER renderer on the root
command only (see CrfLauncher), so --help and a bare command both show it while
subcommands and --version do not.
The class is written to be shared verbatim across CoordinateKit command-line tools: the globe
mark, the "CoordinateKit" wordmark, the layout/color engine, and the brand colors are fixed,
while the per-tool product wordmark and its accent color are supplied through a
Banner.Product passed to the constructor. Nothing here names a specific tool; the owning
launcher builds its Banner.Product and only the product's .txt art differs between
tools.
The art adapts to the terminal in two independent ways. Width selects a
Banner.Layout: the full mark plus "CoordinateKit <product>" when there is room, dropping
the brand name and then the mark as the window narrows, down to nothing below the smallest
legible size (see compose(int, org.coordinatekit.crf.cli.Banner.ColorMode, org.coordinatekit.crf.cli.Banner.Product)). Each layout's threshold is derived from the art it renders,
so any product wordmark width adapts without hand-tuned numbers. Color
capability selects a Banner.ColorMode: 24-bit truecolor, 256-color, or 16-color when
attached to a capable terminal, and uncolored plain text otherwise — including whenever output is
piped or redirected, so a captured stream never carries stray ANSI bytes.
The brand glyphs live as .txt classpath resources rather than Java text blocks because
the art is alignment-significant: trailing spaces carry meaning, and Spotless trims them from
*.java sources but leaves resources untouched.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA tool's product identity: the wordmark art in two sizes plus the accent color its name is painted in. -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Banner
Creates a banner forproduct. The mark and "CoordinateKit" wordmark are fixed; the product supplies its own wordmark art and accent color.- Parameters:
product- the per-tool wordmark and accent color
-
-
Method Details
-
render
Renders the brand art as the root command's header section. Probes the attached terminal lazily — only help and bare-command invocations reach this method, so other runs pay no probe cost — then delegates to the purecompose(int, org.coordinatekit.crf.cli.Banner.ColorMode, org.coordinatekit.crf.cli.Banner.Product). Owns the blank line that separates the art fromUsage:.- Specified by:
renderin interfacepicocli.CommandLine.IHelpSectionRenderer- Parameters:
help- the picocli help model for the command being rendered (unused; the art is global)- Returns:
- the rendered header, or the empty string when no art fits
-