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

@ -61,9 +61,15 @@ fn _main() !void {
const control = globals.control orelse return error.RiverControlNotAdvertised;
const seat = globals.seat orelse return error.SeatNotAdverstised;
// Skip our name, send all other args
// This next line is needed cause of https://github.com/ziglang/zig/issues/2622
const args = os.argv;
if (mem.eql(u8, mem.span(args[1]), "-version")) {
try std.io.getStdOut().writeAll(@import("build_options").version);
std.os.exit(0);
}
// Skip our name, send all other args
for (args[1..]) |arg| control.addArgument(arg);
const callback = try control.runCommand(seat);