Add -version flag to river, riverctl and rivertile

This commit is contained in:
novakane
2021-07-24 11:31:17 +02:00
committed by Isaac Freund
parent 9c633a7888
commit 32d35cdf91
4 changed files with 41 additions and 1 deletions

View File

@ -42,6 +42,7 @@ const usage: []const u8 =
\\ -h Print this help message and exit.
\\ -c <command> Run `sh -c <command>` on startup.
\\ -l <level> Set the log level to a value from 0 to 7.
\\ -version Print the version number and exit.
\\
;
@ -73,6 +74,9 @@ pub fn main() anyerror!void {
} else {
printErrorExit("Error: flag '-l' requires exactly one argument", .{});
}
} else if (std.mem.eql(u8, arg, "-version")) {
try std.io.getStdOut().writeAll(build_options.version);
os.exit(0);
} else {
const stderr = std.io.getStdErr().writer();
try stderr.print(usage, .{});