diff --git a/src/cli.zig b/src/cli.zig index 88c6f298e..871060b02 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -1,3 +1,4 @@ +pub const args = @import("cli/args.zig"); pub const Action = @import("cli/action.zig").Action; test { diff --git a/src/cli_args.zig b/src/cli/args.zig similarity index 99% rename from src/cli_args.zig rename to src/cli/args.zig index 7729548d5..0a326fe89 100644 --- a/src/cli_args.zig +++ b/src/cli/args.zig @@ -4,7 +4,7 @@ const assert = std.debug.assert; const Allocator = mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; -const ErrorList = @import("config/ErrorList.zig"); +const ErrorList = @import("../config/ErrorList.zig"); // TODO: // - Only `--long=value` format is accepted. Do we want to allow diff --git a/src/config/CAPI.zig b/src/config/CAPI.zig index be2a491e7..1912403bc 100644 --- a/src/config/CAPI.zig +++ b/src/config/CAPI.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const cli_args = @import("../cli_args.zig"); +const cli = @import("../cli.zig"); const inputpkg = @import("../input.zig"); const global = &@import("../main.zig").state; @@ -52,8 +52,8 @@ export fn ghostty_config_load_string( fn config_load_string_(self: *Config, str: []const u8) !void { var fbs = std.io.fixedBufferStream(str); - var iter = cli_args.lineIterator(fbs.reader()); - try cli_args.parse(Config, global.alloc, self, &iter); + var iter = cli.args.lineIterator(fbs.reader()); + try cli.args.parse(Config, global.alloc, self, &iter); } /// Load the configuration from the default file locations. This diff --git a/src/config/Config.zig b/src/config/Config.zig index 79b9ea39d..b0fac6b43 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -10,7 +10,7 @@ const fontpkg = @import("../font/main.zig"); const inputpkg = @import("../input.zig"); const terminal = @import("../terminal/main.zig"); const internal_os = @import("../os/main.zig"); -const cli_args = @import("../cli_args.zig"); +const cli = @import("../cli.zig"); const Key = @import("key.zig").Key; const KeyValue = @import("key.zig").Value; @@ -765,8 +765,8 @@ pub fn loadDefaultFiles(self: *Config, alloc: Allocator) !void { std.log.info("reading configuration file path={s}", .{home_config_path}); var buf_reader = std.io.bufferedReader(file.reader()); - var iter = cli_args.lineIterator(buf_reader.reader()); - try cli_args.parse(Config, alloc, self, &iter); + var iter = cli.args.lineIterator(buf_reader.reader()); + try cli.args.parse(Config, alloc, self, &iter); } else |err| switch (err) { error.FileNotFound => std.log.info( "homedir config not found, not loading path={s}", @@ -792,7 +792,7 @@ pub fn loadCliArgs(self: *Config, alloc_gpa: Allocator) !void { // Parse the config from the CLI args var iter = try std.process.argsWithAllocator(alloc_gpa); defer iter.deinit(); - try cli_args.parse(Config, alloc_gpa, self, &iter); + try cli.args.parse(Config, alloc_gpa, self, &iter); } /// Load and parse the config files that were added in the "config-file" key. @@ -819,8 +819,8 @@ pub fn loadRecursiveFiles(self: *Config, alloc: Allocator) !void { defer file.close(); var buf_reader = std.io.bufferedReader(file.reader()); - var iter = cli_args.lineIterator(buf_reader.reader()); - try cli_args.parse(Config, alloc, self, &iter); + var iter = cli.args.lineIterator(buf_reader.reader()); + try cli.args.parse(Config, alloc, self, &iter); // We don't currently support adding more config files to load // from within a loaded config file. This can be supported diff --git a/src/config/Wasm.zig b/src/config/Wasm.zig index e50b4853b..90c06b63a 100644 --- a/src/config/Wasm.zig +++ b/src/config/Wasm.zig @@ -1,6 +1,6 @@ const std = @import("std"); const wasm = @import("../os/wasm.zig"); -const cli_args = @import("../cli_args.zig"); +const cli = @import("../cli.zig"); const alloc = wasm.alloc; const Config = @import("Config.zig"); @@ -43,8 +43,8 @@ export fn config_load_string( fn config_load_string_(self: *Config, str: []const u8) !void { var fbs = std.io.fixedBufferStream(str); - var iter = cli_args.lineIterator(fbs.reader()); - try cli_args.parse(Config, alloc, self, &iter); + var iter = cli.args.lineIterator(fbs.reader()); + try cli.args.parse(Config, alloc, self, &iter); } export fn config_finalize(self: *Config) void { diff --git a/src/main.zig b/src/main.zig index e44c3f9d1..bcd3711ba 100644 --- a/src/main.zig +++ b/src/main.zig @@ -300,6 +300,5 @@ test { // TODO _ = @import("blocking_queue.zig"); _ = @import("config.zig"); - _ = @import("cli_args.zig"); _ = @import("lru.zig"); }