11const std = @import ("std" );
22const testing = std .testing ;
3+ const Writer = std .Io .Writer ;
34
45const ansi_term = @import ("ansi_term" );
56const 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