Render one aligned non-wrapped line

SolidGroundUX DocumentationSolidGroundUX
NL

fn: sgnd_print_single

Purpose

Print a single themed line using left, center or right alignment.

Behavior

  • Print an empty line for empty text.
  • Measure visible width without ANSI sequences.
  • If text is too long, strip styling and truncate to available length.
  • Pad the line to its effective width.

Arguments

  • --text TEXT — Text to render; the first positional argument is also accepted.
  • --textclr ANSI — Text color override.
  • --justify L|C|R — Alignment (default: left).
  • --pad N — Outer padding in spaces (default: 0).
  • --maxwidth N — Maximum render width.

Inputs (globals)

SGND_UI_TEXT, RESET.

Output

Writes one ANSI-styled line and a newline to stdout.

Returns

0 for an empty-text call; otherwise printf status.

Usage

  sgnd_print_single --text "Ready" --justify C --maxwidth 80
  sgnd_print_single "Waiting for input" --justify L --pad 2