Skip to content

Commit 8d34d0b

Browse files
update to zig 0.15.2
1 parent a768c1a commit 8d34d0b

6 files changed

Lines changed: 18 additions & 27 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ jobs:
1616
- uses: actions/checkout@v6
1717
- uses: mlugg/setup-zig@v2
1818
with:
19-
version: 0.14.0
19+
version: 0.15.2
2020
- name: Build
2121
run: zig build test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![CI](https://github.com/ziglibs/zig-lscolors/workflows/CI/badge.svg)
44

55
A zig library for colorizing paths according to the `LS_COLORS`
6-
environment variable. Designed to work with Zig 0.14.0.
6+
environment variable. Designed to work with Zig 0.15.2.
77

88
## Quick Example
99

build.zig.zon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
.fingerprint = 0x4c9ac217b91e4bee,
44
.version = "0.1.0",
55

6-
.minimum_zig_version = "0.14.0",
6+
.minimum_zig_version = "0.15.2",
77

88
.dependencies = .{
99
.ansi_term = .{
10-
.url = "git+https://github.com/ziglibs/ansi_term?ref=v0.1.0#d88bc63e91e2c1cd2e60aaf51196860375c78042",
11-
.hash = "ansi_term-0.1.0-_baAy9djAABNQdiVAt7Iwk4wlBh2kL-UAxEDd3wDs-09",
10+
.url = "git+https://github.com/ziglibs/ansi-term?ref=v0.2.0#7e7d1a6483a37a92c5857ec9a49b3e5085657352",
11+
.hash = "ansi_term-0.2.0-_baAywpoAADR8iCR6FmS5BVkuEwL4sPayaDH1qlil85E",
1212
},
1313
},
1414
.paths = .{

example.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ pub fn main() !void {
1515

1616
var iterator = dir.iterate();
1717
while (try iterator.next()) |itm| {
18-
std.log.info("{}", .{try lsc.styled(itm.name)});
18+
std.log.info("{f}", .{try lsc.styled(itm.name)});
1919
}
2020
}

src/main.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ test "get styled string from default" {
240240
defer lsc.deinit();
241241

242242
const expected = "\x1B[1;34m.\x1B[0m";
243-
const actual = try std.fmt.allocPrint(allocator, "{}", .{try lsc.styled(".")});
243+
const actual = try std.fmt.allocPrint(allocator, "{f}", .{try lsc.styled(".")});
244244
defer allocator.free(actual);
245245

246246
try expectEqualSlices(u8, expected, actual);
@@ -253,7 +253,7 @@ test "get styled path components from default (directory)" {
253253
defer lsc.deinit();
254254

255255
const expected = "\x1B[1;34m.\x1B[0m";
256-
const actual = try std.fmt.allocPrint(allocator, "{}", .{lsc.styledComponents(".")});
256+
const actual = try std.fmt.allocPrint(allocator, "{f}", .{lsc.styledComponents(".")});
257257
defer allocator.free(actual);
258258

259259
try expectEqualSlices(u8, expected, actual);
@@ -266,7 +266,7 @@ test "get styled path components from default (file)" {
266266
defer lsc.deinit();
267267

268268
const expected = "\x1B[1;34m./\x1B[0mmain.zig";
269-
const actual = try std.fmt.allocPrint(allocator, "{}", .{lsc.styledComponents("./main.zig")});
269+
const actual = try std.fmt.allocPrint(allocator, "{f}", .{lsc.styledComponents("./main.zig")});
270270
defer allocator.free(actual);
271271

272272
try expectEqualSlices(u8, expected, actual);

src/styled_path.zig

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const std = @import("std");
22
const testing = std.testing;
3+
const Writer = std.Io.Writer;
34

45
const ansi_term = @import("ansi_term");
56
const style = ansi_term.style;
@@ -19,13 +20,8 @@ pub const StyledPath = struct {
1920

2021
pub fn format(
2122
value: Self,
22-
comptime fmt: []const u8,
23-
options: std.fmt.FormatOptions,
24-
writer: anytype,
25-
) @TypeOf(writer).Error!void {
26-
_ = fmt;
27-
_ = options;
28-
23+
writer: *Writer,
24+
) Writer.Error!void {
2925
const sty = value.style;
3026

3127
try ansi_format.updateStyle(writer, sty, .{});
@@ -42,13 +38,8 @@ pub const StyledPathComponents = struct {
4238

4339
pub fn format(
4440
value: Self,
45-
comptime fmt: []const u8,
46-
options: std.fmt.FormatOptions,
47-
writer: anytype,
48-
) @TypeOf(writer).Error!void {
49-
_ = fmt;
50-
_ = options;
51-
41+
writer: *Writer,
42+
) Writer.Error!void {
5243
var iter = PathComponentIterator.init(value.path);
5344
var current_style: ?Style = Style{};
5445

@@ -76,7 +67,7 @@ test "format default styled path" {
7667
const allocator = std.testing.allocator;
7768

7869
const expected = "/usr/local/bin/zig";
79-
const actual = try std.fmt.allocPrint(allocator, "{}", .{styled_path});
70+
const actual = try std.fmt.allocPrint(allocator, "{f}", .{styled_path});
8071
defer allocator.free(actual);
8172

8273
try testing.expectEqualSlices(u8, expected, actual);
@@ -93,7 +84,7 @@ test "format bold path" {
9384
const allocator = std.testing.allocator;
9485

9586
const expected = "\x1B[1m/usr/local/bin/zig\x1B[0m";
96-
const actual = try std.fmt.allocPrint(allocator, "{}", .{styled_path});
87+
const actual = try std.fmt.allocPrint(allocator, "{f}", .{styled_path});
9788
defer allocator.free(actual);
9889

9990
try testing.expectEqualSlices(u8, expected, actual);
@@ -113,7 +104,7 @@ test "format bold and italic path" {
113104
const allocator = std.testing.allocator;
114105

115106
const expected = "\x1B[1;3m/usr/local/bin/zig\x1B[0m";
116-
const actual = try std.fmt.allocPrint(allocator, "{}", .{styled_path});
107+
const actual = try std.fmt.allocPrint(allocator, "{f}", .{styled_path});
117108
defer allocator.free(actual);
118109

119110
try testing.expectEqualSlices(u8, expected, actual);
@@ -130,7 +121,7 @@ test "format colored path" {
130121
const allocator = std.testing.allocator;
131122

132123
const expected = "\x1B[31m/usr/local/bin/zig\x1B[0m";
133-
const actual = try std.fmt.allocPrint(allocator, "{}", .{styled_path});
124+
const actual = try std.fmt.allocPrint(allocator, "{f}", .{styled_path});
134125
defer allocator.free(actual);
135126

136127
try testing.expectEqualSlices(u8, expected, actual);

0 commit comments

Comments
 (0)