Files
ghostty-rs/crates/ghostty-config/src/lib.rs
T
ddidderr 33d15a2dc2 feat(config): port the configuration system and CLI argument parser
Ports ZIG/src/config (minus C/WASM APIs) and cli/{args,CommaSplitter,
diagnostics}.zig into ghostty-config:
- all 202 options with exact names, types, defaults and verbatim docs,
  declared through one config_struct! macro; Zig's comptime reflection is
  replaced by the ConfigField/CliTarget traits
- loading: default XDG files, -e, config-file includes (optional '?',
  cycle detection), themes incl. light:/dark: pairs, conditional config,
  replay, finalize() derived defaults, clone/changed diffing for reload
- Linux/GTK default keybinds built on ghostty_input::binding::Set
- formatter producing +show-config output

Verified against the installed Ghostty 1.3.1: `+show-config --default`
and `--default --docs` match byte for byte (except gtk-opengl-debug,
which differs between debug/release builds), as do two complex loaded
configs.

Open items (docs/rewrite/notes/ghostty-config.md): url regex needs an
Oniguruma-compatible engine (onig) in the renderer; some font/terminal
types are local copies awaiting integration; KeyRemapSet equality is
order sensitive unlike Zig.

Test Plan:
- cargo test -p ghostty-config (255 tests)
- compare `ghostty +show-config --default --docs` with our formatter
2026-10-11 22:00:12 +02:00

49 lines
1.0 KiB
Rust

//! ghostty-config: configuration parsing, loading and formatting
//! (ZIG/src/config/*, cli/args.zig, cli/CommaSplitter.zig,
//! cli/diagnostics.zig). See docs/rewrite/ARCHITECTURE.md.
#![allow(
clippy::wildcard_imports,
clippy::should_implement_trait,
clippy::float_cmp,
clippy::collapsible_if,
clippy::redundant_closure_for_method_calls,
clippy::single_match_else,
clippy::manual_let_else
)]
// Generic CLI parsing infrastructure.
pub mod cli_args;
pub mod comma_splitter;
pub mod diagnostics;
pub mod macros;
// Config support modules.
pub mod clipboard_codepoint_map;
pub mod command;
pub mod conditional;
pub mod edit;
pub mod error_list;
pub mod file_load;
pub mod formatter;
pub mod io;
pub mod key;
pub mod path;
pub mod repeatable_string_map;
pub mod string;
pub mod theme;
pub mod url;
// Types that were nested in Config.zig.
pub mod font_types;
pub mod input_fields;
pub mod keybinds;
pub mod metric_modifier;
pub mod types_a;
pub mod types_b;
// The Config struct itself.
pub mod config;
pub mod file_formatter;
pub mod keys;