From 42aec5bfa39d33f4df7deb29dac2b12c8c7e7e40 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Sun, 11 Oct 2026 22:00:52 +0200 Subject: [PATCH] chore: add ghostty-cli crate for +action commands --- Cargo.lock | 209 ++++++++++++++++++++++++++++++++++ crates/ghostty-cli/Cargo.toml | 13 +++ crates/ghostty-cli/src/lib.rs | 1 + docs/rewrite/ARCHITECTURE.md | 3 +- 4 files changed, 225 insertions(+), 1 deletion(-) create mode 100644 crates/ghostty-cli/Cargo.toml create mode 100644 crates/ghostty-cli/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 4efa674..75fa80e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -328,6 +328,15 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + [[package]] name = "either" version = "1.19.0" @@ -429,6 +438,17 @@ dependencies = [ "zlib-rs", ] +[[package]] +name = "freetype-sys" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab537ce43cab850c64b4cdc390ce7e4f47f877485ddc323208e268280c308ae" +dependencies = [ + "cc", + "libz-sys", + "pkg-config", +] + [[package]] name = "futures-core" version = "0.3.34" @@ -512,6 +532,15 @@ dependencies = [ "ghostty-input", ] +[[package]] +name = "ghostty-cli" +version = "0.1.0" +dependencies = [ + "ghostty-config", + "ghostty-input", + "ghostty-os", +] + [[package]] name = "ghostty-config" version = "0.1.0" @@ -551,10 +580,15 @@ dependencies = [ name = "ghostty-font" version = "0.1.0" dependencies = [ + "bitflags", + "freetype-sys", + "ghostty-unicode", + "harfbuzz-sys", "log", "png", "thiserror", "tiny-skia", + "yeslogic-fontconfig-sys", ] [[package]] @@ -644,6 +678,20 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "harfbuzz-sys" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b13f1cead31867a0d5b5e8905c262bc02b77701b8cd45ef402988f33745f9b7c" +dependencies = [ + "cc", + "freetype-sys", + "objc2-core-graphics", + "objc2-core-text", + "pkg-config", + "windows", +] + [[package]] name = "hashbrown" version = "0.17.1" @@ -729,6 +777,18 @@ dependencies = [ "windows-link", ] +[[package]] +name = "libz-sys" +version = "1.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bc9657773828b90eeb625adff10eeac83cc21bbfd8e23a03eaa8a33c9e28d9" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" version = "0.12.1" @@ -855,6 +915,34 @@ dependencies = [ "objc_id", ] +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "objc2-core-foundation", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags", + "objc2-core-foundation", +] + [[package]] name = "objc_id" version = "0.1.1" @@ -1372,6 +1460,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "wasm-bindgen" version = "0.2.129" @@ -1439,12 +1533,107 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + [[package]] name = "windows-sys" version = "0.61.2" @@ -1454,6 +1643,15 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + [[package]] name = "winnow" version = "1.0.4" @@ -1463,6 +1661,17 @@ dependencies = [ "memchr", ] +[[package]] +name = "yeslogic-fontconfig-sys" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8b8abf912b9a29ff112e1671c97c33636903d13a69712037190e6805af4f76" +dependencies = [ + "dlib", + "once_cell", + "pkg-config", +] + [[package]] name = "zbus" version = "5.19.0" diff --git a/crates/ghostty-cli/Cargo.toml b/crates/ghostty-cli/Cargo.toml new file mode 100644 index 0000000..01bf699 --- /dev/null +++ b/crates/ghostty-cli/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "ghostty-cli" +version.workspace = true +edition.workspace = true +license.workspace = true + +[dependencies] +ghostty-config.workspace = true +ghostty-input.workspace = true +ghostty-os.workspace = true + +[lints] +workspace = true diff --git a/crates/ghostty-cli/src/lib.rs b/crates/ghostty-cli/src/lib.rs new file mode 100644 index 0000000..0ed9a05 --- /dev/null +++ b/crates/ghostty-cli/src/lib.rs @@ -0,0 +1 @@ +//! ghostty-cli: `ghostty +action` CLI actions (ZIG/src/cli). diff --git a/docs/rewrite/ARCHITECTURE.md b/docs/rewrite/ARCHITECTURE.md index 9f2a215..9135f5c 100644 --- a/docs/rewrite/ARCHITECTURE.md +++ b/docs/rewrite/ARCHITECTURE.md @@ -20,7 +20,8 @@ WASM, Windows and the embedded C API (`libghostty`) are out of scope. | `ghostty-font` | font/* (Metrics, sprite/*, Atlas, discovery via fontconfig, face via freetype, shaper via harfbuzz, Collection, CodepointResolver, SharedGrid(Set), opentype/*, nerd_font_attributes) | config, unicode, terminal | | `ghostty-renderer` | renderer/ generic, OpenGL (+ opengl/*), cell, cursor, image, link, size, State, Thread, Overlay, shadertoy, row, shaders/glsl | config, font, terminal | | `ghostty-termio` | termio/*, pty.zig, Command.zig, shell-integration resources | config, terminal, os | -| `ghostty-core` | App.zig, Surface.zig, surface_mouse.zig, apprt/action.zig, apprt/structs.zig, apprt/surface.zig, global.zig, cli/* actions (+list-fonts, +show-config, ...) | everything below | +| `ghostty-cli` | cli/* actions (+list-themes, +show-config, +list-keybinds, ...) | config, input, os, font | +| `ghostty-core` | App.zig, Surface.zig, surface_mouse.zig, apprt/action.zig, apprt/structs.zig, apprt/surface.zig, global.zig | everything below | | `ghostty-apprt-gtk` | apprt/gtk/* | core, config, input | | root `ghostty-rs` (bin `ghostty`) | main_ghostty.zig, build_config.zig | core, config, apprt-gtk |