aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/main_build_data.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-04-04 19:22:04 +0300
committerCan Celik <ogulcancelik@gmail.com>2026-04-05 01:23:06 +0300
commit41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch)
tree3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/src/main_build_data.zig
parent55c138263e190a1e79d4b997bfb9397306c0ec1f (diff)
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/src/main_build_data.zig')
-rw-r--r--vendor/libghostty-vt/src/main_build_data.zig51
1 files changed, 51 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/main_build_data.zig b/vendor/libghostty-vt/src/main_build_data.zig
new file mode 100644
index 00000000..4e55f449
--- /dev/null
+++ b/vendor/libghostty-vt/src/main_build_data.zig
@@ -0,0 +1,51 @@
+//! This CLI is used to generate data that is used by the build process.
+//!
+//! We used to do this directly in our `build.zig` but the problem with
+//! that approach is that any changes to the dependencies of this data would
+//! force a rebuild of our build binary. If we're just doing something like
+//! running tests and not emitting any of the info below, then that is a
+//! complete waste.
+
+const std = @import("std");
+const Allocator = std.mem.Allocator;
+const cli = @import("cli.zig");
+
+pub const Action = enum {
+ // Shell completions
+ bash,
+ fish,
+ zsh,
+
+ // Editor syntax files
+ sublime,
+ @"vim-syntax",
+ @"vim-ftdetect",
+ @"vim-ftplugin",
+ @"vim-compiler",
+
+ // Other
+ terminfo,
+};
+
+pub fn main() !void {
+ const alloc = std.heap.c_allocator;
+ const action_ = try cli.action.detectArgs(Action, alloc);
+ const action = action_ orelse return error.NoAction;
+
+ // Our output always goes to stdout.
+ var buffer: [1024]u8 = undefined;
+ var stdout_writer = std.fs.File.stdout().writerStreaming(&buffer);
+ const writer = &stdout_writer.interface;
+ switch (action) {
+ .bash => try writer.writeAll(@import("extra/bash.zig").completions),
+ .fish => try writer.writeAll(@import("extra/fish.zig").completions),
+ .zsh => try writer.writeAll(@import("extra/zsh.zig").completions),
+ .sublime => try writer.writeAll(@import("extra/sublime.zig").syntax),
+ .@"vim-syntax" => try writer.writeAll(@import("extra/vim.zig").syntax),
+ .@"vim-ftdetect" => try writer.writeAll(@import("extra/vim.zig").ftdetect),
+ .@"vim-ftplugin" => try writer.writeAll(@import("extra/vim.zig").ftplugin),
+ .@"vim-compiler" => try writer.writeAll(@import("extra/vim.zig").compiler),
+ .terminfo => try @import("terminfo/ghostty.zig").ghostty.encode(writer),
+ }
+ try stdout_writer.end();
+}