mirror of
https://github.com/jetzig-framework/jetzig.git
synced 2025-05-14 22:16:08 +00:00
Merge pull request #51 from jetzig-framework/disable-colors-on-windows
Disable colors on Windows
This commit is contained in:
commit
31e8ae36e1
@ -1,5 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
const types = @import("types.zig");
|
const types = @import("types.zig");
|
||||||
|
|
||||||
const codes = .{
|
const codes = .{
|
||||||
@ -16,15 +18,23 @@ const codes = .{
|
|||||||
};
|
};
|
||||||
|
|
||||||
fn wrap(comptime attribute: []const u8, comptime message: []const u8) []const u8 {
|
fn wrap(comptime attribute: []const u8, comptime message: []const u8) []const u8 {
|
||||||
return codes.escape ++ attribute ++ "m" ++ message ++ codes.escape ++ codes.reset ++ "m";
|
if (builtin.os.tag == .windows) {
|
||||||
|
return message;
|
||||||
|
} else {
|
||||||
|
return codes.escape ++ attribute ++ "m" ++ message ++ codes.escape ++ codes.reset ++ "m";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn runtimeWrap(allocator: std.mem.Allocator, attribute: []const u8, message: []const u8) ![]const u8 {
|
fn runtimeWrap(allocator: std.mem.Allocator, attribute: []const u8, message: []const u8) ![]const u8 {
|
||||||
return try std.mem.join(
|
if (builtin.os.tag == .windows) {
|
||||||
allocator,
|
return try allocator.dupe(u8, message);
|
||||||
"",
|
} else {
|
||||||
&[_][]const u8{ codes.escape, attribute, "m", message, codes.escape, codes.reset, "m" },
|
return try std.mem.join(
|
||||||
);
|
allocator,
|
||||||
|
"",
|
||||||
|
&[_][]const u8{ codes.escape, attribute, "m", message, codes.escape, codes.reset, "m" },
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn black(comptime message: []const u8) []const u8 {
|
pub fn black(comptime message: []const u8) []const u8 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user