Files
ghostty-rs/crates/ghostty-cli/src/lib.rs
T
ddidderr 6286e02f07 feat(cli): port ghostty +action CLI commands
Ports ZIG/src/cli into ghostty-cli: action detection/dispatch with
per-action --help, and the actions help, version, list-actions,
list-colors, list-keybinds, list-themes (plain listing plus an
interactive ratatui browser mirroring Ghostty's libvaxis UI),
show-config, validate-config, edit-config, crash-report (listing),
ssh-cache and boo (235 embedded frames).

Verified byte-for-byte against the installed Ghostty 1.3.1 for stdout,
stderr and exit codes of most actions, incl. tty output in a pty at
widths 20-200. Known differences: +list-colors --plain prints all 782
colors (Ghostty truncates at 617 because it never flushes), +version
has placeholder build info until build_info::set is wired up.

Deferred: list-fonts, show-face (need font discovery integration) and
new-window (needs GTK IPC); they return NotYetAvailable for now.

Test Plan:
- cargo test -p ghostty-cli (86 tests)
- cargo run -p ghostty-cli --example cli -- +list-keybinds --plain
  and diff against `ghostty +list-keybinds --plain`
2026-10-11 22:22:01 +02:00

47 lines
1.1 KiB
Rust

//! ghostty-cli: `ghostty +action` CLI actions (ZIG/src/cli).
//!
//! Every action lives in its own module and exposes `run(args)`, which takes
//! the full process argument vector (including `argv[0]`, like Zig's
//! `args.argsIterator`) and returns the process exit code. Actions write to
//! stdout/stderr exactly like the Zig implementation.
#![allow(
clippy::wildcard_imports,
clippy::struct_field_names,
clippy::items_after_statements,
clippy::needless_pass_by_value,
clippy::too_many_arguments,
clippy::type_complexity,
clippy::collapsible_if,
clippy::doc_lazy_continuation,
clippy::doc_overindented_list_items
)]
#[macro_use]
mod options;
pub mod action;
pub mod boo;
pub mod build_info;
pub mod crash_report;
pub mod edit_config;
pub mod error;
pub mod ghostty;
pub mod help;
pub mod list_actions;
pub mod list_colors;
pub mod list_fonts;
pub mod list_keybinds;
pub mod list_themes;
pub mod new_window;
pub mod show_config;
pub mod show_face;
pub mod ssh_cache;
pub mod tui;
pub mod validate_config;
pub mod version;
pub use error::Error;
pub use ghostty::{Action, run_from_args};
pub use options::{NoOptions, parse_options};