diff --git a/build.zig b/build.zig index 242d4f20bdafdb8b697122564dfc239bbaa5bf34..0fb490189aa3ade0fda5498d8cc97b7bbb6301b7 100644 --- a/build.zig +++ b/build.zig @@ -1,27 +1,24 @@ -const Builder = @import("std").build.Builder; +const std = @import("std"); +const Builder = std.build.Builder; pub fn build(b: *Builder) void { - // Standard target options allows the person running `zig build` to choose - // what target to build for. Here we do not override the defaults, which - // means any target is allowed, and the default is native. Other options - // for restricting supported target set are available. const target = b.standardTargetOptions(.{}); + const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug; - // Standard release options allow the person running `zig build` to select - // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. - const mode = b.standardReleaseOptions(); + const exe = b.addExecutable(.{ + .name = "zig-ansi", + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = mode, + }); + b.installArtifact(exe); - const exe = b.addExecutable("zig-ansi", "src/main.zig"); - exe.setTarget(target); - exe.setBuildMode(mode); - exe.install(); - - const run_cmd = exe.run(); + const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); } - const run_step = b.step("run", "Run the app"); + const run_step = b.step("test", "Run the app"); run_step.dependOn(&run_cmd.step); } diff --git a/licenses.txt b/licenses.txt new file mode 100644 index 0000000000000000000000000000000000000000..6336b470e0dc9933d1fad883c84eaf86174573d6 --- /dev/null +++ b/licenses.txt @@ -0,0 +1,3 @@ +MIT: += https://spdx.org/licenses/MIT +- This diff --git a/src/main.zig b/src/main.zig index e17c55cd37a7bf9aa1527052d843c34b2377686d..bb69b844fcc37e6f188ec1077476436e265d6a21 100644 --- a/src/main.zig +++ b/src/main.zig @@ -3,19 +3,19 @@ const std = @import("std"); const ansi = @import("./lib.zig"); pub fn main() anyerror!void { - std.debug.warn(comptime ansi.color.Fg(.Red, "All your codebase are belong to us.\n"), .{}); - std.debug.warn(comptime ansi.color.Fg(.Green, "All your codebase are belong to us.\n"), .{}); - std.debug.warn(comptime ansi.color.Fg(.Yellow, "All your codebase are belong to us.\n"), .{}); - std.debug.warn(comptime ansi.color.Fg(.Blue, "All your codebase are belong to us.\n"), .{}); - std.debug.warn(comptime ansi.color.Fg(.Magenta, "All your codebase are belong to us.\n"), .{}); - std.debug.warn(comptime ansi.color.Fg(.Cyan, "All your codebase are belong to us.\n"), .{}); + std.debug.print(comptime ansi.color.Fg(.Red, "All your codebase are belong to us.\n"), .{}); + std.debug.print(comptime ansi.color.Fg(.Green, "All your codebase are belong to us.\n"), .{}); + std.debug.print(comptime ansi.color.Fg(.Yellow, "All your codebase are belong to us.\n"), .{}); + std.debug.print(comptime ansi.color.Fg(.Blue, "All your codebase are belong to us.\n"), .{}); + std.debug.print(comptime ansi.color.Fg(.Magenta, "All your codebase are belong to us.\n"), .{}); + std.debug.print(comptime ansi.color.Fg(.Cyan, "All your codebase are belong to us.\n"), .{}); - std.debug.warn("\n", .{}); + std.debug.print("\n", .{}); - std.debug.warn(comptime ansi.color.Bg(.Red, "All your codebase are belong to us.\n"), .{}); - std.debug.warn(comptime ansi.color.Bg(.Green, "All your codebase are belong to us.\n"), .{}); - std.debug.warn(comptime ansi.color.Bg(.Yellow, "All your codebase are belong to us.\n"), .{}); - std.debug.warn(comptime ansi.color.Bg(.Blue, "All your codebase are belong to us.\n"), .{}); - std.debug.warn(comptime ansi.color.Bg(.Magenta, "All your codebase are belong to us.\n"), .{}); - std.debug.warn(comptime ansi.color.Bg(.Cyan, "All your codebase are belong to us.\n"), .{}); + std.debug.print(comptime ansi.color.Bg(.Red, "All your codebase are belong to us.\n"), .{}); + std.debug.print(comptime ansi.color.Bg(.Green, "All your codebase are belong to us.\n"), .{}); + std.debug.print(comptime ansi.color.Bg(.Yellow, "All your codebase are belong to us.\n"), .{}); + std.debug.print(comptime ansi.color.Bg(.Blue, "All your codebase are belong to us.\n"), .{}); + std.debug.print(comptime ansi.color.Bg(.Magenta, "All your codebase are belong to us.\n"), .{}); + std.debug.print(comptime ansi.color.Bg(.Cyan, "All your codebase are belong to us.\n"), .{}); }