Skip to content

Commit b44ab9c

Browse files
chore: minor updates
1 parent a2f7e6b commit b44ab9c

9 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/cli/Command.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub const ParseContext = struct {
1616
return .{
1717
.allocator = allocator,
1818
.options = std.StringHashMap([]const u8).init(allocator),
19-
.arguments = std.ArrayList([]const u8){},
19+
.arguments = std.ArrayList([]const u8).empty,
2020
.command_name = command_name,
2121
};
2222
}
@@ -58,10 +58,10 @@ pub fn init(allocator: std.mem.Allocator, name: []const u8, description: []const
5858
cmd.* = .{
5959
.name = name,
6060
.description = description,
61-
.aliases = std.ArrayList([]const u8){},
62-
.options = std.ArrayList(Option){},
63-
.arguments = std.ArrayList(Argument){},
64-
.subcommands = std.ArrayList(*Command){},
61+
.aliases = std.ArrayList([]const u8).empty,
62+
.options = std.ArrayList(Option).empty,
63+
.arguments = std.ArrayList(Argument).empty,
64+
.subcommands = std.ArrayList(*Command).empty,
6565
.allocator = allocator,
6666
};
6767
return cmd;

src/config/Json5Parser.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn parseKey(self: *Json5Parser) ![]const u8 {
185185

186186
fn parseArray(self: *Json5Parser) !Value {
187187
self.pos += 1; // Skip '['
188-
var items = std.ArrayList(Value){};
188+
var items = std.ArrayList(Value).empty;
189189
errdefer {
190190
for (items.items) |*item| {
191191
item.deinit(self.allocator);
@@ -236,7 +236,7 @@ fn parseString(self: *Json5Parser) !Value {
236236
const quote = self.source[self.pos];
237237
self.pos += 1; // Skip opening quote
238238

239-
var str = std.ArrayList(u8){};
239+
var str = std.ArrayList(u8).empty;
240240
errdefer str.deinit(self.allocator);
241241

242242
while (self.pos < self.source.len) {

src/config/JsoncParser.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ fn parseObject(self: *JsoncParser) !Value {
152152

153153
fn parseArray(self: *JsoncParser) !Value {
154154
self.pos += 1; // Skip '['
155-
var items = std.ArrayList(Value){};
155+
var items = std.ArrayList(Value).empty;
156156
errdefer {
157157
for (items.items) |*item| {
158158
item.deinit(self.allocator);
@@ -202,7 +202,7 @@ fn parseArray(self: *JsoncParser) !Value {
202202
fn parseString(self: *JsoncParser) !Value {
203203
self.pos += 1; // Skip opening '"'
204204

205-
var str = std.ArrayList(u8){};
205+
var str = std.ArrayList(u8).empty;
206206
errdefer str.deinit(self.allocator);
207207

208208
while (self.pos < self.source.len) {

src/config/TomlParser.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn parseString(self: *TomlParser) !Value {
185185

186186
fn parseArray(self: *TomlParser) !Value {
187187
self.pos += 1; // Skip '['
188-
var items = std.ArrayList(Value){};
188+
var items = std.ArrayList(Value).empty;
189189
errdefer {
190190
for (items.items) |*item| {
191191
item.deinit(self.allocator);

src/prompt/Box.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub const Box = struct {
163163
}
164164

165165
fn splitLines(self: *Box, content: []const u8) ![][]const u8 {
166-
var list = std.ArrayList([]const u8){};
166+
var list = std.ArrayList([]const u8).empty;
167167
errdefer list.deinit(self.allocator);
168168

169169
var iter = std.mem.splitScalar(u8, content, '\n');

src/prompt/MultiSelectPrompt.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ selected_index: usize,
1818
checked: std.ArrayList(bool),
1919

2020
pub fn init(allocator: std.mem.Allocator, message: []const u8, choices: []const Choice) !MultiSelectPrompt {
21-
var checked = std.ArrayList(bool){};
21+
var checked = std.ArrayList(bool).empty;
2222
try checked.appendNTimes(allocator, false, choices.len);
2323

2424
return .{
@@ -64,7 +64,7 @@ pub fn prompt(self: *MultiSelectPrompt) ![][]const u8 {
6464
}
6565

6666
// Collect checked values
67-
var result = std.ArrayList([]const u8){};
67+
var result = std.ArrayList([]const u8).empty;
6868
for (self.choices, 0..) |choice, i| {
6969
if (self.checked.items[i]) {
7070
const value_copy = try self.core.allocator.dupe(u8, choice.value);

src/prompt/PromptCore.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn init(allocator: std.mem.Allocator) PromptCore {
2020
.terminal = Terminal.init(),
2121
.state = .initial,
2222
.raw_mode = null,
23-
.value = std.ArrayList(u8){},
23+
.value = std.ArrayList(u8).empty,
2424
.cursor = 0,
2525
.error_message = null,
2626
};

src/prompt/Style.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub const Style = struct {
174174
}
175175

176176
// Build ANSI code sequence
177-
var codes: std.ArrayList(u8) = .{};
177+
var codes: std.ArrayList(u8) = .empty;
178178
defer codes.deinit(self.allocator);
179179

180180
var first = true;

src/prompt/Table.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn init(allocator: std.mem.Allocator, columns: []const Column) Table {
3737
.allocator = allocator,
3838
.terminal = terminal,
3939
.columns = columns,
40-
.rows = std.ArrayList([]const []const u8){},
40+
.rows = std.ArrayList([]const []const u8).empty,
4141
.style = if (terminal.supports_unicode) .rounded else .simple,
4242
.show_header = true,
4343
};

0 commit comments

Comments
 (0)