Class Banner

java.lang.Object
org.coordinatekit.crf.cli.Banner
All Implemented Interfaces:
picocli.CommandLine.IHelpSectionRenderer

@NullMarked public final class Banner extends Object implements picocli.CommandLine.IHelpSectionRenderer
Renders the CoordinateKit brand art — the globe "mark" stacked above a figlet-style word banner — as the header section of a tool's root usage message. Registered as the 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 Classes
    Modifier and Type
    Class
    Description
    static interface 
    A tool's product identity: the wordmark art in two sizes plus the accent color its name is painted in.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a banner for product.
  • Method Summary

    Modifier and Type
    Method
    Description
    render(picocli.CommandLine.Help help)
    Renders the brand art as the root command's header section.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Banner

      public Banner(Banner.Product product)
      Creates a banner for product. 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

      public String render(picocli.CommandLine.Help help)
      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 pure compose(int, org.coordinatekit.crf.cli.Banner.ColorMode, org.coordinatekit.crf.cli.Banner.Product). Owns the blank line that separates the art from Usage:.
      Specified by:
      render in interface picocli.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