From 0a970854c1f5c8c11b6ab3ec50328ab8ec137fe5 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sat, 5 Jun 2021 20:39:56 -0700 Subject: [PATCH] inline ansi red foreground code and remove `libs/zig-ansi` submodule --- .gitmodules | 3 --- build.zig | 1 - deps.zig | 2 -- libs/zig-ansi | 1 - src/util/funcs.zig | 7 ++++--- zig.mod | 7 ++----- 6 files changed, 6 insertions(+), 15 deletions(-) delete mode 160000 libs/zig-ansi diff --git a/.gitmodules b/.gitmodules index 98a5892013ea30bde881462a6f3f2f53fdda0961..14062d542bba6f8abe61e8e394b1e1f12930d96b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "libs/yaml"] path = libs/yaml url = https://github.com/yaml/libyaml -[submodule "libs/zig-ansi"] - path = libs/zig-ansi - url = https://github.com/nektro/zig-ansi diff --git a/build.zig b/build.zig index 08f0c87416b7691bd820bdefe04ebd9605b75ad5..4ec2c030eae1ac7f910b3657e19a26949563d5f1 100644 --- a/build.zig +++ b/build.zig @@ -41,7 +41,6 @@ pub fn build(b: *Builder) void { exe.addCSourceFile("./libs/yaml/src/writer.c", &.{}); exe.addPackagePath("zigmod", "./src/lib.zig"); - exe.addPackagePath("ansi", "./libs/zig-ansi/src/lib.zig"); } else { deps.addAllTo(exe); } diff --git a/deps.zig b/deps.zig index c749eddc1c9f0061b85c6972367586bfff5ef13f..ea4535c63718dd50e44af6916d0ae4c78f5d8f8d 100644 --- a/deps.zig +++ b/deps.zig @@ -71,12 +71,10 @@ pub const package_data = struct { pub const packages = &[_]std.build.Pkg{ package_data._89ujp8gq842x, - package_data._s84v9o48ucb0, }; pub const pkgs = struct { pub const zigmod = packages[0]; - pub const ansi = packages[1]; }; pub const c_include_dirs = &[_][]const u8{ diff --git a/libs/zig-ansi b/libs/zig-ansi deleted file mode 160000 index 876c32c42044a5e1554f4662b4b9bdfad7ee5086..0000000000000000000000000000000000000000 --- a/libs/zig-ansi +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 876c32c42044a5e1554f4662b4b9bdfad7ee5086 diff --git a/src/util/funcs.zig b/src/util/funcs.zig index 8bafb0307250572f24d5e73764484e35a8804a47..b5f5cba26ce89f7ea0894d23bac15cec07c3f04a 100644 --- a/src/util/funcs.zig +++ b/src/util/funcs.zig @@ -1,8 +1,6 @@ const std = @import("std"); const gpa = std.heap.c_allocator; -const ansi = @import("ansi"); - const u = @import("index.zig"); // @@ -17,9 +15,12 @@ pub fn print(comptime fmt: []const u8, args: anytype) void { std.debug.print(fmt ++ "\n", args); } +const ansi_red = "\x1B[31m"; +const ansi_reset = "\x1B[39m"; + pub fn assert(ok: bool, comptime fmt: []const u8, args: anytype) void { if (!ok) { - print(comptime ansi.color.Fg(.Red, "error: " ++ fmt), args); + print(ansi_red ++ fmt ++ ansi_reset, args); std.os.exit(1); } } diff --git a/zig.mod b/zig.mod index 1097d857c4aa736af4aa88c7577d815457088e77..c6ea2c4bf037a0dbe2e39921667c503156a5ad69 100644 --- a/zig.mod +++ b/zig.mod @@ -25,12 +25,12 @@ dependencies: - src/scanner.c - src/writer.c - - src: git https://github.com/nektro/zig-ansi - # Entries above this line are needed to bootstrap and kept as git submodules # -------- # Entries below this line are only fetched with zigmod itself + - src: git https://github.com/nektro/zig-ansi + - src: git https://github.com/ziglibs/known-folders - src: git https://github.com/nektro/zig-licenses @@ -40,6 +40,3 @@ dependencies: - src: git https://github.com/nektro/zig-json - src: http https://aquila.red/1/nektro/range/v0.1.tar.gz sha256-d2f72fdd8cdb8 0 1 - -dev_dependencies: - - src: git https://github.com/nektro/zig-ansi -- 2.54.0