refactor: allow mocking of root module functions for easier unittesting
This commit is contained in:
parent
5d760f1d84
commit
3c55ed876b
28 changed files with 187 additions and 30 deletions
24
build.zig
24
build.zig
|
|
@ -338,6 +338,11 @@ pub fn build_exe(
|
||||||
.root_source_file = b.path("help.md"),
|
.root_source_file = b.path("help.md"),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const soft_root_mod = b.createModule(.{
|
||||||
|
.root_source_file = b.path("src/soft_root.zig"),
|
||||||
|
.imports = &.{},
|
||||||
|
});
|
||||||
|
|
||||||
const config_mod = b.createModule(.{
|
const config_mod = b.createModule(.{
|
||||||
.root_source_file = b.path("src/config.zig"),
|
.root_source_file = b.path("src/config.zig"),
|
||||||
.imports = &.{
|
.imports = &.{
|
||||||
|
|
@ -352,9 +357,18 @@ pub fn build_exe(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const file_link_mod = b.createModule(.{
|
||||||
|
.root_source_file = b.path("src/file_link.zig"),
|
||||||
|
.imports = &.{
|
||||||
|
.{ .name = "soft_root", .module = soft_root_mod },
|
||||||
|
.{ .name = "thespian", .module = thespian_mod },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const file_type_config_mod = b.createModule(.{
|
const file_type_config_mod = b.createModule(.{
|
||||||
.root_source_file = b.path("src/file_type_config.zig"),
|
.root_source_file = b.path("src/file_type_config.zig"),
|
||||||
.imports = &.{
|
.imports = &.{
|
||||||
|
.{ .name = "soft_root", .module = soft_root_mod },
|
||||||
.{ .name = "syntax", .module = syntax_mod },
|
.{ .name = "syntax", .module = syntax_mod },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -470,6 +484,7 @@ pub fn build_exe(
|
||||||
const keybind_mod = b.createModule(.{
|
const keybind_mod = b.createModule(.{
|
||||||
.root_source_file = b.path("src/keybind/keybind.zig"),
|
.root_source_file = b.path("src/keybind/keybind.zig"),
|
||||||
.imports = &.{
|
.imports = &.{
|
||||||
|
.{ .name = "soft_root", .module = soft_root_mod },
|
||||||
.{ .name = "cbor", .module = cbor_mod },
|
.{ .name = "cbor", .module = cbor_mod },
|
||||||
.{ .name = "command", .module = command_mod },
|
.{ .name = "command", .module = command_mod },
|
||||||
.{ .name = "EventHandler", .module = EventHandler_mod },
|
.{ .name = "EventHandler", .module = EventHandler_mod },
|
||||||
|
|
@ -538,6 +553,7 @@ pub fn build_exe(
|
||||||
const project_manager_mod = b.createModule(.{
|
const project_manager_mod = b.createModule(.{
|
||||||
.root_source_file = b.path("src/project_manager.zig"),
|
.root_source_file = b.path("src/project_manager.zig"),
|
||||||
.imports = &.{
|
.imports = &.{
|
||||||
|
.{ .name = "soft_root", .module = soft_root_mod },
|
||||||
.{ .name = "log", .module = log_mod },
|
.{ .name = "log", .module = log_mod },
|
||||||
.{ .name = "cbor", .module = cbor_mod },
|
.{ .name = "cbor", .module = cbor_mod },
|
||||||
.{ .name = "thespian", .module = thespian_mod },
|
.{ .name = "thespian", .module = thespian_mod },
|
||||||
|
|
@ -570,6 +586,8 @@ pub fn build_exe(
|
||||||
const tui_mod = b.createModule(.{
|
const tui_mod = b.createModule(.{
|
||||||
.root_source_file = b.path("src/tui/tui.zig"),
|
.root_source_file = b.path("src/tui/tui.zig"),
|
||||||
.imports = &.{
|
.imports = &.{
|
||||||
|
.{ .name = "soft_root", .module = soft_root_mod },
|
||||||
|
.{ .name = "file_link", .module = file_link_mod },
|
||||||
.{ .name = "renderer", .module = renderer_mod },
|
.{ .name = "renderer", .module = renderer_mod },
|
||||||
.{ .name = "input", .module = input_mod },
|
.{ .name = "input", .module = input_mod },
|
||||||
.{ .name = "thespian", .module = thespian_mod },
|
.{ .name = "thespian", .module = thespian_mod },
|
||||||
|
|
@ -623,6 +641,8 @@ pub fn build_exe(
|
||||||
}
|
}
|
||||||
if (pie) |value| exe.pie = value;
|
if (pie) |value| exe.pie = value;
|
||||||
exe.root_module.addImport("build_options", options_mod);
|
exe.root_module.addImport("build_options", options_mod);
|
||||||
|
exe.root_module.addImport("soft_root", soft_root_mod);
|
||||||
|
exe.root_module.addImport("file_link", file_link_mod);
|
||||||
exe.root_module.addImport("flags", flags_dep.module("flags"));
|
exe.root_module.addImport("flags", flags_dep.module("flags"));
|
||||||
exe.root_module.addImport("cbor", cbor_mod);
|
exe.root_module.addImport("cbor", cbor_mod);
|
||||||
exe.root_module.addImport("config", config_mod);
|
exe.root_module.addImport("config", config_mod);
|
||||||
|
|
@ -670,6 +690,8 @@ pub fn build_exe(
|
||||||
});
|
});
|
||||||
|
|
||||||
check_exe.root_module.addImport("build_options", options_mod);
|
check_exe.root_module.addImport("build_options", options_mod);
|
||||||
|
check_exe.root_module.addImport("file_link", file_link_mod);
|
||||||
|
check_exe.root_module.addImport("soft_root", soft_root_mod);
|
||||||
check_exe.root_module.addImport("flags", flags_dep.module("flags"));
|
check_exe.root_module.addImport("flags", flags_dep.module("flags"));
|
||||||
check_exe.root_module.addImport("cbor", cbor_mod);
|
check_exe.root_module.addImport("cbor", cbor_mod);
|
||||||
check_exe.root_module.addImport("config", config_mod);
|
check_exe.root_module.addImport("config", config_mod);
|
||||||
|
|
@ -701,6 +723,8 @@ pub fn build_exe(
|
||||||
|
|
||||||
tests.pie = pie;
|
tests.pie = pie;
|
||||||
tests.root_module.addImport("build_options", options_mod);
|
tests.root_module.addImport("build_options", options_mod);
|
||||||
|
tests.root_module.addImport("soft_root", soft_root_mod);
|
||||||
|
tests.root_module.addImport("file_link", file_link_mod);
|
||||||
tests.root_module.addImport("log", log_mod);
|
tests.root_module.addImport("log", log_mod);
|
||||||
tests.root_module.addImport("Buffer", Buffer_mod);
|
tests.root_module.addImport("Buffer", Buffer_mod);
|
||||||
tests.root_module.addImport("color", color_mod);
|
tests.root_module.addImport("color", color_mod);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const tp = @import("thespian");
|
const tp = @import("thespian");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const tracy = @import("tracy");
|
const tracy = @import("tracy");
|
||||||
|
|
||||||
allocator: std.mem.Allocator,
|
allocator: std.mem.Allocator,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ const std = @import("std");
|
||||||
const tp = @import("thespian");
|
const tp = @import("thespian");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const log = @import("log");
|
const log = @import("log");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const dizzy = @import("dizzy");
|
const dizzy = @import("dizzy");
|
||||||
const Buffer = @import("Buffer");
|
const Buffer = @import("Buffer");
|
||||||
const fuzzig = @import("fuzzig");
|
const fuzzig = @import("fuzzig");
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const tp = @import("thespian");
|
const tp = @import("thespian");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
|
|
||||||
pub const Dest = union(enum) {
|
pub const Dest = union(enum) {
|
||||||
file: FileDest,
|
file: FileDest,
|
||||||
|
|
|
||||||
|
|
@ -246,4 +246,4 @@ fn vec(comptime args: anytype) []const []const u8 {
|
||||||
|
|
||||||
const syntax = @import("syntax");
|
const syntax = @import("syntax");
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ const tp = @import("thespian");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const log = @import("log");
|
const log = @import("log");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
|
|
||||||
const input = @import("input");
|
const input = @import("input");
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ const bin_path = @import("bin_path");
|
||||||
const sep = std.fs.path.sep;
|
const sep = std.fs.path.sep;
|
||||||
|
|
||||||
const list_languages = @import("list_languages.zig");
|
const list_languages = @import("list_languages.zig");
|
||||||
pub const file_link = @import("file_link.zig");
|
const file_link = @import("file_link");
|
||||||
|
|
||||||
const c = @cImport({
|
const c = @cImport({
|
||||||
@cInclude("locale.h");
|
@cInclude("locale.h");
|
||||||
|
|
@ -21,8 +21,8 @@ const log = @import("log");
|
||||||
pub const version = @embedFile("version");
|
pub const version = @embedFile("version");
|
||||||
pub const version_info = @embedFile("version_info");
|
pub const version_info = @embedFile("version_info");
|
||||||
|
|
||||||
pub var max_diff_lines: usize = 50000;
|
pub const max_diff_lines: usize = 50000;
|
||||||
pub var max_syntax_lines: usize = 50000;
|
pub const max_syntax_lines: usize = 50000;
|
||||||
|
|
||||||
pub const application_name = "flow";
|
pub const application_name = "flow";
|
||||||
pub const application_title = "Flow Control";
|
pub const application_title = "Flow Control";
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ const cbor = @import("cbor");
|
||||||
const log = @import("log");
|
const log = @import("log");
|
||||||
const tracy = @import("tracy");
|
const tracy = @import("tracy");
|
||||||
const file_type_config = @import("file_type_config");
|
const file_type_config = @import("file_type_config");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const Buffer = @import("Buffer");
|
const Buffer = @import("Buffer");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ const io = std.io;
|
||||||
const posix = std.posix;
|
const posix = std.posix;
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const File = std.fs.File;
|
const File = std.fs.File;
|
||||||
const windows = std.os.windows;
|
const windows = std.os.windows;
|
||||||
const native_arch = builtin.cpu.arch;
|
const native_arch = builtin.cpu.arch;
|
||||||
|
|
|
||||||
132
src/soft_root.zig
Normal file
132
src/soft_root.zig
Normal file
|
|
@ -0,0 +1,132 @@
|
||||||
|
const std = @import("std");
|
||||||
|
pub const hard_root = @import("root");
|
||||||
|
|
||||||
|
pub const root = struct {
|
||||||
|
pub const version = if (@hasDecl(hard_root, "version")) hard_root.version else dummy.version;
|
||||||
|
pub const version_info = if (@hasDecl(hard_root, "version_info")) hard_root.version_info else dummy.version_info;
|
||||||
|
pub const application_name = if (@hasDecl(hard_root, "application_name")) hard_root.application_name else dummy.application_name;
|
||||||
|
pub const application_title = if (@hasDecl(hard_root, "application_title")) hard_root.application_title else dummy.application_title;
|
||||||
|
pub const application_subtext = if (@hasDecl(hard_root, "application_subtext")) hard_root.application_subtext else dummy.application_subtext;
|
||||||
|
|
||||||
|
pub const get_state_dir = if (@hasDecl(hard_root, "get_state_dir")) hard_root.get_state_dir else dummy.get_state_dir;
|
||||||
|
pub const get_config_dir = if (@hasDecl(hard_root, "get_config_dir")) hard_root.get_config_dir else dummy.get_config_dir;
|
||||||
|
pub const write_config_to_writer = if (@hasDecl(hard_root, "write_config_to_writer")) hard_root.write_config_to_writer else dummy.write_config_to_writer;
|
||||||
|
pub const parse_text_config_file = if (@hasDecl(hard_root, "parse_text_config_file")) hard_root.parse_text_config_file else dummy.parse_text_config_file;
|
||||||
|
pub const list_keybind_namespaces = if (@hasDecl(hard_root, "list_keybind_namespaces")) hard_root.list_keybind_namespaces else dummy.list_keybind_namespaces;
|
||||||
|
pub const read_keybind_namespace = if (@hasDecl(hard_root, "read_keybind_namespace")) hard_root.read_keybind_namespace else dummy.read_keybind_namespace;
|
||||||
|
pub const write_keybind_namespace = if (@hasDecl(hard_root, "write_keybind_namespace")) hard_root.write_keybind_namespace else dummy.write_keybind_namespace;
|
||||||
|
pub const get_keybind_namespace_file_name = if (@hasDecl(hard_root, "get_keybind_namespace_file_name")) hard_root.get_keybind_namespace_file_name else dummy.get_keybind_namespace_file_name;
|
||||||
|
|
||||||
|
pub const ConfigDirError = if (@hasDecl(hard_root, "ConfigDirError")) hard_root.ConfigDirError else dummy.ConfigDirError;
|
||||||
|
pub const ConfigWriteError = if (@hasDecl(hard_root, "ConfigWriteError")) hard_root.ConfigWriteError else dummy.ConfigWriteError;
|
||||||
|
|
||||||
|
pub const free_config = if (@hasDecl(hard_root, "free_config")) hard_root.free_config else dummy.free_config;
|
||||||
|
pub const read_config = if (@hasDecl(hard_root, "read_config")) hard_root.read_config else dummy.read_config;
|
||||||
|
pub const write_config = if (@hasDecl(hard_root, "write_config")) hard_root.write_config else dummy.write_config;
|
||||||
|
pub const exists_config = if (@hasDecl(hard_root, "exists_config")) hard_root.exists_config else dummy.exists_config;
|
||||||
|
pub const get_config_file_name = if (@hasDecl(hard_root, "get_config_file_name")) hard_root.get_config_file_name else dummy.get_config_file_name;
|
||||||
|
pub const get_restore_file_name = if (@hasDecl(hard_root, "get_restore_file_name")) hard_root.get_restore_file_name else dummy.get_restore_file_name;
|
||||||
|
|
||||||
|
pub const read_theme = if (@hasDecl(hard_root, "read_theme")) hard_root.read_theme else dummy.read_theme;
|
||||||
|
pub const write_theme = if (@hasDecl(hard_root, "write_theme")) hard_root.write_theme else dummy.write_theme;
|
||||||
|
pub const get_theme_file_name = if (@hasDecl(hard_root, "get_theme_file_name")) hard_root.get_theme_file_name else dummy.get_theme_file_name;
|
||||||
|
|
||||||
|
pub const exit = if (@hasDecl(hard_root, "exit")) hard_root.exit else dummy.exit;
|
||||||
|
pub const print_exit_status = if (@hasDecl(hard_root, "print_exit_status")) hard_root.print_exit_status else dummy.print_exit_status;
|
||||||
|
|
||||||
|
pub const is_directory = if (@hasDecl(hard_root, "is_directory")) hard_root.is_directory else dummy.is_directory;
|
||||||
|
pub const is_file = if (@hasDecl(hard_root, "is_file")) hard_root.is_file else dummy.is_file;
|
||||||
|
|
||||||
|
pub const shorten_path = if (@hasDecl(hard_root, "shorten_path")) hard_root.shorten_path else dummy.shorten_path;
|
||||||
|
|
||||||
|
pub const max_diff_lines = if (@hasDecl(hard_root, "max_diff_lines")) hard_root.max_diff_lines else dummy.max_diff_lines;
|
||||||
|
pub const max_syntax_lines = if (@hasDecl(hard_root, "max_syntax_lines")) hard_root.max_syntax_lines else dummy.max_syntax_lines;
|
||||||
|
};
|
||||||
|
|
||||||
|
const dummy = struct {
|
||||||
|
pub const version = "dummy-version";
|
||||||
|
pub const version_info = "dummy-version_info";
|
||||||
|
pub const application_name = "dummy-application_name";
|
||||||
|
pub const application_title = "dummy-application_title";
|
||||||
|
pub const application_subtext = "dummy-application_subtext";
|
||||||
|
|
||||||
|
pub const max_diff_lines: usize = 50000;
|
||||||
|
pub const max_syntax_lines: usize = 50000;
|
||||||
|
|
||||||
|
pub const ConfigDirError = error{};
|
||||||
|
pub const ConfigWriteError = error{};
|
||||||
|
|
||||||
|
pub fn get_state_dir() ![]const u8 {
|
||||||
|
@panic("dummy get_state_dir call");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_config_dir() ConfigDirError![]const u8 {
|
||||||
|
@panic("dummy get_state_dir call");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn write_config_to_writer(comptime T: type, _: T, _: *std.Io.Writer) std.Io.Writer.Error!void {
|
||||||
|
@panic("dummy write_config_to_writer call");
|
||||||
|
}
|
||||||
|
pub fn parse_text_config_file(T: type, _: std.mem.Allocator, _: *T, _: *[][]const u8, _: []const u8, _: []const u8) !void {
|
||||||
|
@panic("dummy parse_text_config_file call");
|
||||||
|
}
|
||||||
|
pub fn list_keybind_namespaces(_: std.mem.Allocator) ![]const []const u8 {
|
||||||
|
@panic("dummy list_keybind_namespaces call");
|
||||||
|
}
|
||||||
|
pub fn read_keybind_namespace(_: std.mem.Allocator, _: []const u8) ?[]const u8 {
|
||||||
|
@panic("dummy read_keybind_namespace call");
|
||||||
|
}
|
||||||
|
pub fn write_keybind_namespace(_: []const u8, _: []const u8) !void {
|
||||||
|
@panic("dummy write_keybind_namespace call");
|
||||||
|
}
|
||||||
|
pub fn get_keybind_namespace_file_name(_: []const u8) ![]const u8 {
|
||||||
|
@panic("dummy get_keybind_namespace_file_name call");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn free_config(_: std.mem.Allocator, _: [][]const u8) void {
|
||||||
|
@panic("dummy free_config call");
|
||||||
|
}
|
||||||
|
pub fn read_config(T: type, _: std.mem.Allocator) struct { T, [][]const u8 } {
|
||||||
|
@panic("dummy read_config call");
|
||||||
|
}
|
||||||
|
pub fn write_config(_: anytype, _: std.mem.Allocator) (ConfigDirError || ConfigWriteError)!void {
|
||||||
|
@panic("dummy write_config call");
|
||||||
|
}
|
||||||
|
pub fn exists_config(_: type) bool {
|
||||||
|
@panic("dummy exists_config call");
|
||||||
|
}
|
||||||
|
pub fn get_config_file_name(_: type) ![]const u8 {
|
||||||
|
@panic("dummy get_config_file_name call");
|
||||||
|
}
|
||||||
|
pub fn get_restore_file_name() ![]const u8 {
|
||||||
|
@panic("dummy get_restore_file_name call");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn read_theme(_: std.mem.Allocator, _: []const u8) ?[]const u8 {
|
||||||
|
@panic("dummy read_theme call");
|
||||||
|
}
|
||||||
|
pub fn write_theme(_: []const u8, _: []const u8) !void {
|
||||||
|
@panic("dummy write_theme call");
|
||||||
|
}
|
||||||
|
pub fn get_theme_file_name(_: []const u8) ![]const u8 {
|
||||||
|
@panic("dummy get_theme_file_name call");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn exit(_: u8) noreturn {
|
||||||
|
@panic("dummy exit call");
|
||||||
|
}
|
||||||
|
pub fn print_exit_status(_: void, _: []const u8) void {
|
||||||
|
@panic("dummy print_exit_status call");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_directory(_: []const u8) bool {
|
||||||
|
@panic("dummy is_directory call");
|
||||||
|
}
|
||||||
|
pub fn is_file(_: []const u8) bool {
|
||||||
|
@panic("dummy is_file call");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn shorten_path(_: []u8, _: []const u8, _: *usize, _: usize) []const u8 {
|
||||||
|
@panic("dummy shorten_path call");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -10,7 +10,7 @@ const text_manip = @import("text_manip");
|
||||||
const syntax = @import("syntax");
|
const syntax = @import("syntax");
|
||||||
const file_type_config = @import("file_type_config");
|
const file_type_config = @import("file_type_config");
|
||||||
const project_manager = @import("project_manager");
|
const project_manager = @import("project_manager");
|
||||||
const root_mod = @import("root");
|
const root_mod = @import("soft_root").root;
|
||||||
|
|
||||||
const Plane = @import("renderer").Plane;
|
const Plane = @import("renderer").Plane;
|
||||||
const Cell = @import("renderer").Cell;
|
const Cell = @import("renderer").Cell;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ const tp = @import("thespian");
|
||||||
const tracy = @import("tracy");
|
const tracy = @import("tracy");
|
||||||
const diff = @import("diff");
|
const diff = @import("diff");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
|
|
||||||
const Plane = @import("renderer").Plane;
|
const Plane = @import("renderer").Plane;
|
||||||
const style = @import("renderer").style;
|
const style = @import("renderer").style;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ const Allocator = @import("std").mem.Allocator;
|
||||||
const Plane = @import("renderer").Plane;
|
const Plane = @import("renderer").Plane;
|
||||||
const tp = @import("thespian");
|
const tp = @import("thespian");
|
||||||
const log = @import("log");
|
const log = @import("log");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
const EventHandler = @import("EventHandler");
|
const EventHandler = @import("EventHandler");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ const cbor = @import("cbor");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
const Plane = @import("renderer").Plane;
|
const Plane = @import("renderer").Plane;
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
|
|
||||||
const Widget = @import("Widget.zig");
|
const Widget = @import("Widget.zig");
|
||||||
const Button = @import("Button.zig");
|
const Button = @import("Button.zig");
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ const tp = @import("thespian");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const tracy = @import("tracy");
|
const tracy = @import("tracy");
|
||||||
const ripgrep = @import("ripgrep");
|
const ripgrep = @import("ripgrep");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const location_history = @import("location_history");
|
const location_history = @import("location_history");
|
||||||
const project_manager = @import("project_manager");
|
const project_manager = @import("project_manager");
|
||||||
const log = @import("log");
|
const log = @import("log");
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ const std = @import("std");
|
||||||
const tp = @import("thespian");
|
const tp = @import("thespian");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const log = @import("log");
|
const log = @import("log");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
|
|
||||||
const input = @import("input");
|
const input = @import("input");
|
||||||
const keybind = @import("keybind");
|
const keybind = @import("keybind");
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ const tp = @import("thespian");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const log = @import("log");
|
const log = @import("log");
|
||||||
const file_type_config = @import("file_type_config");
|
const file_type_config = @import("file_type_config");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
|
|
||||||
const input = @import("input");
|
const input = @import("input");
|
||||||
const keybind = @import("keybind");
|
const keybind = @import("keybind");
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const tp = @import("thespian");
|
const tp = @import("thespian");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
const project_manager = @import("project_manager");
|
const project_manager = @import("project_manager");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const tp = @import("thespian");
|
const tp = @import("thespian");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
|
|
||||||
const tui = @import("../../tui.zig");
|
const tui = @import("../../tui.zig");
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const tp = @import("thespian");
|
const tp = @import("thespian");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
|
|
||||||
const tui = @import("../../tui.zig");
|
const tui = @import("../../tui.zig");
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const tp = @import("thespian");
|
const tp = @import("thespian");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
|
|
||||||
const tui = @import("../../tui.zig");
|
const tui = @import("../../tui.zig");
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const tp = @import("thespian");
|
const tp = @import("thespian");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
const Buffer = @import("Buffer");
|
const Buffer = @import("Buffer");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const tp = @import("thespian");
|
const tp = @import("thespian");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
|
|
||||||
const tui = @import("../../tui.zig");
|
const tui = @import("../../tui.zig");
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ const tp = @import("thespian");
|
||||||
const log = @import("log");
|
const log = @import("log");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const file_type_config = @import("file_type_config");
|
const file_type_config = @import("file_type_config");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
|
|
||||||
const Plane = @import("renderer").Plane;
|
const Plane = @import("renderer").Plane;
|
||||||
const input = @import("input");
|
const input = @import("input");
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ const tp = @import("thespian");
|
||||||
const tracy = @import("tracy");
|
const tracy = @import("tracy");
|
||||||
const config = @import("config");
|
const config = @import("config");
|
||||||
const Buffer = @import("Buffer");
|
const Buffer = @import("Buffer");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const project_manager = @import("project_manager");
|
const project_manager = @import("project_manager");
|
||||||
|
|
||||||
const Plane = @import("renderer").Plane;
|
const Plane = @import("renderer").Plane;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const tp = @import("thespian");
|
const tp = @import("thespian");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
|
|
||||||
const EventHandler = @import("EventHandler");
|
const EventHandler = @import("EventHandler");
|
||||||
const Plane = @import("renderer").Plane;
|
const Plane = @import("renderer").Plane;
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,10 @@ const tp = @import("thespian");
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const log = @import("log");
|
const log = @import("log");
|
||||||
const project_manager = @import("project_manager");
|
const project_manager = @import("project_manager");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
const tracy = @import("tracy");
|
const tracy = @import("tracy");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
|
const file_link = @import("file_link");
|
||||||
|
|
||||||
pub const renderer = @import("renderer");
|
pub const renderer = @import("renderer");
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
|
|
@ -1151,10 +1152,10 @@ const cmds = struct {
|
||||||
pub fn open_file(self: *Self, ctx: Ctx) Result {
|
pub fn open_file(self: *Self, ctx: Ctx) Result {
|
||||||
if (get_active_selection(self.allocator)) |text| {
|
if (get_active_selection(self.allocator)) |text| {
|
||||||
defer self.allocator.free(text);
|
defer self.allocator.free(text);
|
||||||
const link = try root.file_link.parse(text);
|
const link = try file_link.parse(text);
|
||||||
switch (link) {
|
switch (link) {
|
||||||
.file => |file| if (file.exists)
|
.file => |file| if (file.exists)
|
||||||
return root.file_link.navigate(tp.self_pid(), &link),
|
return file_link.navigate(tp.self_pid(), &link),
|
||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const tracy = @import("tracy");
|
const tracy = @import("tracy");
|
||||||
const build_options = @import("build_options");
|
const build_options = @import("build_options");
|
||||||
const root = @import("root");
|
const root = @import("soft_root").root;
|
||||||
|
|
||||||
const ID_ICON_FLOW = 1;
|
const ID_ICON_FLOW = 1;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue