diff --git a/scripts/mzteinit/build.zig.zon b/scripts/mzteinit/build.zig.zon index 0c58373..d4fd6b3 100644 --- a/scripts/mzteinit/build.zig.zon +++ b/scripts/mzteinit/build.zig.zon @@ -4,8 +4,8 @@ .dependencies = .{ .ansi_term = .{ - .url = "https://github.com/LordMZTE/ansi-term/archive/feb152d594486e7dce09e0ee8dd168155de7ce7c.tar.gz", + .url = "https://github.com/ziglibs/ansi-term/archive/3238ee3600775a0d2ed52fa5bf30669daebd47cd.tar.gz", .hash = "122054a0aadb65c0b51e0d2b6083272c8ccd59abe83469425c3ea03030e450df4625", }, }, -}, +} diff --git a/scripts/mzteinit/gyro.zzz b/scripts/mzteinit/gyro.zzz deleted file mode 100644 index 54da900..0000000 --- a/scripts/mzteinit/gyro.zzz +++ /dev/null @@ -1,6 +0,0 @@ -deps: - ansi-term: - git: - url: "https://github.com/ziglibs/ansi-term.git" - ref: b1541b3982d28562060b79cfcb2e561a3307cd0c - root: src/main.zig diff --git a/scripts/prompt/build.zig b/scripts/prompt/build.zig index 8e97e43..79622c8 100644 --- a/scripts/prompt/build.zig +++ b/scripts/prompt/build.zig @@ -1,25 +1,22 @@ const std = @import("std"); -const pkgs = @import("deps.zig").pkgs; pub fn build(b: *std.build.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.standardOptimizeOption(.{}); - // 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("prompt", "src/main.zig"); - exe.setTarget(target); - exe.setBuildMode(mode); + const exe = b.addExecutable(.{ + .name = "prompt", + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = mode, + }); exe.strip = mode != .Debug; exe.linkLibC(); exe.linkSystemLibrary("libgit2"); - pkgs.addAllTo(exe); + + exe.addModule("ansi-term", b.dependency("ansi_term", .{}).module("ansi-term")); + exe.addModule("known-folders", b.dependency("known_folders", .{}).module("known-folders")); exe.install(); @@ -31,11 +28,4 @@ pub fn build(b: *std.build.Builder) void { const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); - - const exe_tests = b.addTest("src/main.zig"); - exe_tests.setTarget(target); - exe_tests.setBuildMode(mode); - - const test_step = b.step("test", "Run unit tests"); - test_step.dependOn(&exe_tests.step); } diff --git a/scripts/prompt/build.zig.zon b/scripts/prompt/build.zig.zon new file mode 100644 index 0000000..dcf6ece --- /dev/null +++ b/scripts/prompt/build.zig.zon @@ -0,0 +1,15 @@ +.{ + .name = "mzteinit", + .version = "0.0.0", + + .dependencies = .{ + .ansi_term = .{ + .url = "https://github.com/ziglibs/ansi-term/archive/3238ee3600775a0d2ed52fa5bf30669daebd47cd.tar.gz", + .hash = "122054a0aadb65c0b51e0d2b6083272c8ccd59abe83469425c3ea03030e450df4625", + }, + .known_folders = .{ + .url = "https://github.com/ziglibs/known-folders/archive/53fe3b676f32e59d46f4fd201d7ab200e5f6cb98.tar.gz", + .hash = "12203e18503cd0fa097a4404b0c4f8535a68536886b536ae51c786455238ba5f183b", + }, + }, +} diff --git a/scripts/prompt/gyro.zzz b/scripts/prompt/gyro.zzz deleted file mode 100644 index 0029687..0000000 --- a/scripts/prompt/gyro.zzz +++ /dev/null @@ -1,11 +0,0 @@ -deps: - ansi-term: - git: - url: "https://github.com/ziglibs/ansi-term.git" - ref: 1c4b9aa23e159b297e4008181ff649c246dc8abe - root: src/main.zig - known-folders: - git: - url: "https://github.com/ziglibs/known-folders.git" - ref: 9db1b99219c767d5e24994b1525273fe4031e464 - root: known-folders.zig diff --git a/scripts/prompt/src/FishMode.zig b/scripts/prompt/src/FishMode.zig index 4a04175..672462a 100644 --- a/scripts/prompt/src/FishMode.zig +++ b/scripts/prompt/src/FishMode.zig @@ -24,7 +24,7 @@ pub fn parse(s: []const u8) Self { } /// Gets the color for the mode -pub fn getColor(self: *Self) at.Color { +pub fn getColor(self: *Self) at.style.Color { return switch (self.mode) { .default => .{ .Yellow = {} }, .insert => .{ .Green = {} }, diff --git a/scripts/prompt/src/prompt.zig b/scripts/prompt/src/prompt.zig index d3b5b67..0570b23 100644 --- a/scripts/prompt/src/prompt.zig +++ b/scripts/prompt/src/prompt.zig @@ -6,6 +6,9 @@ const checkGitError = ffi.checkGitError; const c = ffi.c; const FishMode = @import("FishMode.zig"); +const Style = at.style.Style; +const Color = at.style.Color; + const symbols = struct { const left_separator = ""; const right_separator = ""; @@ -30,7 +33,7 @@ pub fn render(writer: anytype, status: i16, mode: FishMode) !void { fn Renderer(comptime Writer: type) type { return struct { - last_style: ?at.Style, + last_style: ?Style, writer: Writer, status: i16, mode: FishMode, @@ -41,9 +44,9 @@ fn Renderer(comptime Writer: type) type { //const alloc = std.heap.c_allocator; const left_color = if (self.status == 0) - at.Color{ .Green = {} } + Color{ .Green = {} } else - at.Color{ .Red = {} }; + Color{ .Red = {} }; try self.setStyle(.{ .foreground = left_color }); try self.writer.writeAll(symbols.top_left); @@ -166,7 +169,7 @@ fn Renderer(comptime Writer: type) type { // branch with no commits if (head_err == c.GIT_EUNBORNBRANCH) { - const bg = at.Color{ .Grey = 200 }; + const bg = Color{ .Grey = 200 }; try self.drawLeftSep(bg); try self.setStyle(.{ .background = bg, @@ -239,12 +242,12 @@ fn Renderer(comptime Writer: type) type { } } - fn setStyle(self: *Self, style: at.Style) !void { - try at.updateStyle(self.writer, style, self.*.last_style); + fn setStyle(self: *Self, style: Style) !void { + try at.format.updateStyle(self.writer, style, self.*.last_style); self.last_style = style; } - fn drawLeftSep(self: *Self, new_bg: at.Color) !void { + fn drawLeftSep(self: *Self, new_bg: Color) !void { try self.writer.writeAll(" "); try self.setStyle(.{ .background = self.last_style.?.background, @@ -292,17 +295,17 @@ const GitStatusCounts = struct { staged: c_int = 0, unstaged: c_int = 0, - pub fn getColor(self: *GitStatusCounts) at.Color { + pub fn getColor(self: *GitStatusCounts) Color { const has_staged = self.staged > 0; const has_unstaged = self.unstaged > 0; return if (!has_staged and !has_unstaged) - at.Color{ .Blue = {} } + Color{ .Blue = {} } else if (has_staged and has_unstaged) - at.Color{ .Magenta = {} } + Color{ .Magenta = {} } else if (has_staged) - at.Color{ .Green = {} } + Color{ .Green = {} } else - at.Color{ .Grey = 200 }; + Color{ .Grey = 200 }; } }; diff --git a/scripts/randomwallpaper/build.zig b/scripts/randomwallpaper/build.zig index 73b743b..68d5282 100644 --- a/scripts/randomwallpaper/build.zig +++ b/scripts/randomwallpaper/build.zig @@ -1,19 +1,15 @@ const std = @import("std"); pub fn build(b: *std.build.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.standardOptimizeOption(.{}); - // 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("randomwallpaper", "src/main.zig"); - exe.setTarget(target); - exe.setBuildMode(mode); + const exe = b.addExecutable(.{ + .name = "randomwallpaper", + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = mode, + }); exe.linkLibC(); exe.linkSystemLibrary("x11"); @@ -31,11 +27,4 @@ pub fn build(b: *std.build.Builder) void { const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); - - const exe_tests = b.addTest("src/main.zig"); - exe_tests.setTarget(target); - exe_tests.setBuildMode(mode); - - const test_step = b.step("test", "Run unit tests"); - test_step.dependOn(&exe_tests.step); } diff --git a/scripts/vinput/build.zig b/scripts/vinput/build.zig index 15182a9..a06c7c9 100644 --- a/scripts/vinput/build.zig +++ b/scripts/vinput/build.zig @@ -1,19 +1,15 @@ const std = @import("std"); pub fn build(b: *std.build.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.standardOptimizeOption(.{}); - // 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("vinput", "src/main.zig"); - exe.setTarget(target); - exe.setBuildMode(mode); + const exe = b.addExecutable(.{ + .name = "vinput", + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = mode, + }); exe.linkLibC(); exe.linkSystemLibrary("x11"); @@ -30,11 +26,4 @@ pub fn build(b: *std.build.Builder) void { const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); - - const exe_tests = b.addTest("src/main.zig"); - exe_tests.setTarget(target); - exe_tests.setBuildMode(mode); - - const test_step = b.step("test", "Run unit tests"); - test_step.dependOn(&exe_tests.step); }