Read, parse, and update canonical script header comments in SolidGroundUX files
Source: target-root/usr/local/lib/solidgroundux/common/sgnd-comment-header-parser.sh
Read, parse, and update canonical script header comments in SolidGroundUX files
Public functions
- Extract the initial contiguous comment header from a source file.
- Append fields from one source-header section into a datatable.
- Recognize a named comment-section heading.
- Cache one source file header for repeated queries.
- Retrieve a section from the currently cached source header.
- Hash a script while excluding its mutable metadata checksum fields.
- Refresh script checksum/build metadata and optionally bump version.
- Read a named section from a source-file header into a shell variable.
- Extract a named section from previously loaded comment text.
- Header get banner parts from text
- Split a banner comment into product and title.
- Read a named field from a source-header section.
- Print a named field value directly to stdout.
- Header get banner parts
- Extract a field value from an already loaded section string.
- Header add field
- Set an existing metadata field or insert it when absent.
- Header set field
- Update the framework version/build assignments in a shell source file.
Description
Provides parsing, lookup, and update utilities for canonical script header comments used throughout the SolidGroundUX framework.
The library:
- Detects top-level canonical header sections
- Loads header section fields into sgnd-datatable structures
- Extracts banner information such as product and title
- Reads individual header field values from structured sections
- Updates existing header fields while preserving formatting
- Adds missing fields where required
- Supports checksum, build, and semantic version metadata workflows
Design principles
- Header comments are treated as structured, machine-readable data
- Header parsing and header mutation are kept predictable and convention-based
- Existing field formatting is preserved wherever possible
- Metadata workflows remain independent from higher-level UI logic
Role in framework
- Core header metadata parsing and update layer for script tooling
- Supports release preparation and other header-aware development utilities
- Provides the canonical API for header field inspection and mutation
Non-goals
- Parsing arbitrary inline documentation blocks in source bodies
- Rendering documentation output
- Acting as a general-purpose text processing library
