build: fix trailing newline in version string

This commit is contained in:
Isaac Freund 2021-11-02 23:54:44 +01:00
parent d4aa64034c
commit 69d1453741
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
4 changed files with 7 additions and 4 deletions

View file

@ -61,7 +61,10 @@ pub fn build(b: *zbs.Builder) !void {
&ret, &ret,
.Inherit, .Inherit,
) catch break :blk version; ) catch break :blk version;
break :blk try std.fmt.allocPrintZ(b.allocator, "{s}-{s}", .{ version, git_commit_hash }); break :blk try std.fmt.allocPrintZ(b.allocator, "{s}-{s}", .{
version,
mem.trim(u8, git_commit_hash, &std.ascii.spaces),
});
} else { } else {
break :blk version; break :blk version;
} }

View file

@ -63,7 +63,7 @@ pub fn main() anyerror!void {
} }
if (result.boolFlag("-version")) { if (result.boolFlag("-version")) {
try io.getStdOut().writeAll(build_options.version); try io.getStdOut().writeAll(build_options.version ++ "\n");
os.exit(0); os.exit(0);
} }
if (result.argFlag("-log-level")) |level_str| { if (result.argFlag("-log-level")) |level_str| {

View file

@ -78,7 +78,7 @@ fn _main() !void {
os.exit(0); os.exit(0);
} }
if (result.boolFlag("-version")) { if (result.boolFlag("-version")) {
try io.getStdOut().writeAll(@import("build_options").version); try io.getStdOut().writeAll(@import("build_options").version ++ "\n");
os.exit(0); os.exit(0);
} }

View file

@ -332,7 +332,7 @@ pub fn main() !void {
if (result.args.len != 0) fatalPrintUsage("unknown option '{s}'", .{result.args[0]}); if (result.args.len != 0) fatalPrintUsage("unknown option '{s}'", .{result.args[0]});
if (result.boolFlag("-version")) { if (result.boolFlag("-version")) {
try std.io.getStdOut().writeAll(@import("build_options").version); try std.io.getStdOut().writeAll(@import("build_options").version ++ "\n");
os.exit(0); os.exit(0);
} }
if (result.argFlag("-view-padding")) |raw| { if (result.argFlag("-view-padding")) |raw| {