-
-
Save kbd/0a19b1387e3f64f1ffda8d7f16b71b73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ zig run repo_status.zig | |
./repo_status.zig:426:17: error: comptime control flow inside runtime block | |
continue; | |
^ | |
./repo_status.zig:425:13: note: runtime block created here | |
if (num == 0) | |
^ | |
./repo_status.zig:484:5: note: referenced here | |
try writeStatusStr(shell, status); | |
^ | |
$ zig run repo_status.zig | |
./repo_status.zig:418:5: error: unable to evaluate constant expression | |
for (format) |f| { | |
^ | |
./repo_status.zig:484:5: note: referenced here | |
try writeStatusStr(shell, status); | |
^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var format = .{ | |
// using arrays over tuples failed because they're comptime | |
.{.color = C.green, .token = "↑", .status = Status.ahead}, | |
.{.color = C.red, .token = "↓", .status = Status.behind}, | |
.{.color = C.green, .token = "●", .status = Status.staged}, | |
.{.color = C.yellow, .token = "+", .status = Status.modified}, | |
.{.color = C.red, .token = "-", .status = Status.removed}, | |
.{.color = C.cyan, .token = "…", .status = Status.untracked}, | |
.{.color = C.blue, .token = "⚑", .status = Status.stashed}, | |
.{.color = C.red, .token = "✖", .status = Status.conflicted}, | |
}; | |
// print stats | |
var printed_space = false; | |
for (format) |f| { | |
if (f.status == Status.stashed) { | |
var stashstr = ""; // formatStashes(status); | |
if (std.mem.eql(u8, stashstr, "")) | |
continue; | |
} else { | |
var num = status.status[@enumToInt(f.status)]; | |
if (num == 0) | |
continue; | |
} | |
if (!printed_space){ | |
try print(" ", .{}); | |
printed_space = true; | |
} | |
try styleWrite(shell, f.color, f.token); | |
try styleWrite(shell, f.color, numstr); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh no:
When I added: