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`
15 lines
525 B
Rust
15 lines
525 B
Rust
//! End-to-end runner for the CLI actions:
|
|
//! `cargo run -p ghostty-cli --example cli -- +list-actions --docs`
|
|
//!
|
|
//! Behaves like `ghostty` when an action is given (including `--version`,
|
|
//! `--help` and `-h`), and otherwise prints a note.
|
|
|
|
fn main() {
|
|
let args: Vec<String> = std::env::args().collect();
|
|
if let Some(code) = ghostty_cli::run_from_args(&args) {
|
|
std::process::exit(i32::from(code));
|
|
}
|
|
eprintln!("no +action given (this example only runs CLI actions)");
|
|
std::process::exit(2);
|
|
}
|