mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 14:03:10 -05:00
build: add the dumpArgs function
Use it in Zigling.compile, in order to reduce code duplication.
This commit is contained in:
parent
9de89f6d60
commit
ea4144a416
1 changed files with 10 additions and 10 deletions
20
build.zig
20
build.zig
|
@ -388,37 +388,32 @@ const ZiglingStep = struct {
|
||||||
print("{s}{s}: Unable to spawn the following command: file not found{s}\n", .{
|
print("{s}{s}: Unable to spawn the following command: file not found{s}\n", .{
|
||||||
red_text, self.exercise.main_file, reset_text,
|
red_text, self.exercise.main_file, reset_text,
|
||||||
});
|
});
|
||||||
for (argv) |v| print("{s} ", .{v});
|
dumpArgs(argv);
|
||||||
print("\n", .{});
|
|
||||||
},
|
},
|
||||||
error.ExitCodeFailure => {
|
error.ExitCodeFailure => {
|
||||||
print("{s}{s}: The following command exited with error code {}:{s}\n", .{
|
print("{s}{s}: The following command exited with error code {}:{s}\n", .{
|
||||||
red_text, self.exercise.main_file, code, reset_text,
|
red_text, self.exercise.main_file, code, reset_text,
|
||||||
});
|
});
|
||||||
for (argv) |v| print("{s} ", .{v});
|
dumpArgs(argv);
|
||||||
print("\n", .{});
|
|
||||||
},
|
},
|
||||||
error.ProcessTerminated => {
|
error.ProcessTerminated => {
|
||||||
print("{s}{s}: The following command terminated unexpectedly:{s}\n", .{
|
print("{s}{s}: The following command terminated unexpectedly:{s}\n", .{
|
||||||
red_text, self.exercise.main_file, reset_text,
|
red_text, self.exercise.main_file, reset_text,
|
||||||
});
|
});
|
||||||
for (argv) |v| print("{s} ", .{v});
|
dumpArgs(argv);
|
||||||
print("\n", .{});
|
|
||||||
},
|
},
|
||||||
error.ZigIPCError => {
|
error.ZigIPCError => {
|
||||||
// Commenting this out for now. It always shows up when compilation fails.
|
// Commenting this out for now. It always shows up when compilation fails.
|
||||||
//print("{s}{s}: The following command failed to communicate the compilation result:{s}\n", .{
|
//print("{s}{s}: The following command failed to communicate the compilation result:{s}\n", .{
|
||||||
// red_text, self.exercise.main_file, reset_text,
|
// red_text, self.exercise.main_file, reset_text,
|
||||||
//});
|
//});
|
||||||
//for (argv) |v| print("{s} ", .{v});
|
//dumpArgs(argv);
|
||||||
//print("\n", .{});
|
|
||||||
},
|
},
|
||||||
else => {
|
else => {
|
||||||
print("{s}{s}: Unexpected error: {s}{s}\n", .{
|
print("{s}{s}: Unexpected error: {s}{s}\n", .{
|
||||||
red_text, self.exercise.main_file, @errorName(err), reset_text,
|
red_text, self.exercise.main_file, @errorName(err), reset_text,
|
||||||
});
|
});
|
||||||
for (argv) |v| print("{s} ", .{v});
|
dumpArgs(argv);
|
||||||
print("\n", .{});
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,6 +563,11 @@ const ZiglingStep = struct {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fn dumpArgs(args: []const []const u8) void {
|
||||||
|
for (args) |arg| print("{s} ", .{arg});
|
||||||
|
print("\n", .{});
|
||||||
|
}
|
||||||
|
|
||||||
/// Clears the entire line and move the cursor to column zero.
|
/// Clears the entire line and move the cursor to column zero.
|
||||||
/// Used for clearing the compiler and build_runner progress messages.
|
/// Used for clearing the compiler and build_runner progress messages.
|
||||||
fn resetLine() void {
|
fn resetLine() void {
|
||||||
|
|
Loading…
Reference in a new issue