mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 08:16:13 +03:00
config: -e replaces previous args
This commit is contained in:
@ -1167,6 +1167,7 @@ pub fn parseManuallyHook(self: *Config, alloc: Allocator, arg: []const u8, iter:
|
||||
}
|
||||
|
||||
// All further arguments are parameters
|
||||
self.@"command-arg".list.clearRetainingCapacity();
|
||||
while (iter.next()) |param| {
|
||||
try self.@"command-arg".parseCLI(alloc, param);
|
||||
}
|
||||
@ -1356,6 +1357,21 @@ test "parse e: command and args" {
|
||||
try testing.expectEqualStrings("bar baz", cfg.@"command-arg".list.items[1]);
|
||||
}
|
||||
|
||||
test "parse e: command replaces args" {
|
||||
const testing = std.testing;
|
||||
var cfg = try Config.default(testing.allocator);
|
||||
defer cfg.deinit();
|
||||
const alloc = cfg._arena.?.allocator();
|
||||
|
||||
try cfg.@"command-arg".parseCLI(alloc, "foo");
|
||||
try testing.expectEqual(@as(usize, 1), cfg.@"command-arg".list.items.len);
|
||||
|
||||
var it: TestIterator = .{ .data = &.{"echo"} };
|
||||
try testing.expect(!try cfg.parseManuallyHook(alloc, "-e", &it));
|
||||
try testing.expectEqualStrings("echo", cfg.command.?);
|
||||
try testing.expectEqual(@as(usize, 0), cfg.@"command-arg".list.items.len);
|
||||
}
|
||||
|
||||
test "clone default" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
Reference in New Issue
Block a user