- apprt-gtk: Ghostty's runtime+build-time version gating (at_least) with cargo features adw_1_3/adw_1_4/adw_1_5/gtk_4_16 (default on) and the fallbacks for older libraries: MessageDialog (adw < 1.5), clipboard dialog without SwitchRow, pre-Banner debug warning and child-exited widgets, the old about dialog, GTK 4.16 CSS error source bytes. The minimum stays GTK 4.14 / libadwaita 1.5 (Ghostty's floor). The root build links with -z lazy so version-gated symbols don't keep older libraries from loading. - ghostty-helpgen (port of helpgen.zig) generates CLI action help and keybinding action docs from doc comments at build time, replacing the checked-in help/*.txt; +help and +list-actions --docs stay byte-identical to Ghostty 1.3.1. - ghostty-bench: libc wcwidth mode and separate simd/table and uucode/table code paths like Zig. - ghostty-cli: Windows branches of edit-config, list-colors, list-keybinds and boo; ssh-cache DiskCache flock locking (no-op on Windows, as in Zig) with an exclusivity test. Test Plan: - cargo test --workspace - diff <(cargo run -q -- +list-actions --docs) \ <(ghostty +list-actions --docs)
2.1 KiB
2.1 KiB
compat-GC: helpgen (ZIG/src/helpgen.zig)
Zig generates help strings at build time from doc comments (helpgen.zig,
exposed as help_strings). The Rust port does the same instead of keeping
checked-in tables.
Design
- New crate
crates/ghostty-helpgen(no dependencies), used as a[build-dependencies]ofghostty-cliandghostty-input.doc_lines: port ofextractDocComments/findCommonPrefix(strip///, remove the common leading-space prefix of non-blank lines, keep blank lines and code fences verbatim).run_fn_doc: doc comment of a module'srunfunction (ZiggenActions).enum_variant_docs:///docs per variant of an enum (ZiggenKeybindActions).*_match: emit Rustmatch self { ... }bodies with escaped literals.
ghostty-cli/build.rsreads the variants ofenum Actioninsrc/ghostty.rs, mapsListFonts->src/list_fonts.rs, extracts the doc ofpub fn run, writes$OUT_DIR/action_help.rs;Action::help_textinclude!s it. A missing doc comment fails the build (as in Zig). The formersrc/help/*.txtfiles are deleted.ghostty-input/build.rsextracts the docs of every variant ofenum Actioninsrc/binding/action.rs(now///instead of//), writes$OUT_DIR/keybind_action_docs.rs, included byActionKey::docs(docs = lines joined by\nplus one trailing\n, as before;help_stringstrips one).- Config help already derives from field docs through
config_struct!(ghostty-config/src/macros.rs), so no generation was needed there. - A line-based scanner is used rather than
syn: it mirrors Zig's token based approach (doc run + following item) and avoids a heavy build dep.
Verification
Outputs of +help, +list-actions [--docs] and every +<action> --help
were captured before and after: byte identical. Differences vs
/usr/bin/ghostty exist only for +version --help and +new-window --help
(unchanged from the baseline).
Tests
ghostty-helpgen unit tests (marker stripping, common prefix, blank lines,
code fences, ////, run-doc and enum-variant extraction, escaping).