feat: add open_version_info command

This commit is contained in:
CJ van den Berg 2025-01-30 14:51:36 +01:00
parent f9c83ce02a
commit 56e6412837
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 11 additions and 1 deletions

View file

@ -14,6 +14,8 @@ const c = @cImport({
const build_options = @import("build_options"); const build_options = @import("build_options");
const log = @import("log"); const log = @import("log");
pub const version_info = @embedFile("version_info");
pub var max_diff_lines: usize = 50000; pub var max_diff_lines: usize = 50000;
pub var max_syntax_lines: usize = 50000; pub var max_syntax_lines: usize = 50000;
@ -117,7 +119,7 @@ pub fn main() anyerror!void {
}; };
if (args.version) if (args.version)
return std.io.getStdOut().writeAll(@embedFile("version_info")); return std.io.getStdOut().writeAll(version_info);
if (args.list_languages) { if (args.list_languages) {
const stdout = std.io.getStdOut(); const stdout = std.io.getStdOut();

View file

@ -382,6 +382,14 @@ const cmds = struct {
} }
pub const open_font_test_text_meta = .{ .description = "Open font glyph test text" }; pub const open_font_test_text_meta = .{ .description = "Open font glyph test text" };
pub fn open_version_info(self: *Self, _: Ctx) Result {
tui.reset_drag_context();
try self.create_editor();
try command.executeName("open_scratch_buffer", command.fmt(.{ "version", root.version_info, "diff" }));
tui.need_render();
}
pub const open_version_info_meta = .{ .description = "Show build version information" };
pub fn open_config(_: *Self, _: Ctx) Result { pub fn open_config(_: *Self, _: Ctx) Result {
const file_name = try root.get_config_file_name(@import("config")); const file_name = try root.get_config_file_name(@import("config"));
try tp.self_pid().send(.{ "cmd", "navigate", .{ .file = file_name[0 .. file_name.len - 5] } }); try tp.self_pid().send(.{ "cmd", "navigate", .{ .file = file_name[0 .. file_name.len - 5] } });