Changes
2 changed files (+26/-7)
-
-
@@ -321,6 +321,14 @@ return ParseArgsError.UnknownArg;} }; pub const WaitOptions = struct { event_type: ?EventType = null, pub fn parseArg(self: *@This(), arg: []const u8, args: *std.process.ArgIterator) ParseArgsError!void { self.event_type = try EventType.parseArg(self.event_type, arg, args); } }; pub const ListOptions = struct { event_type: ?EventType = null, days: c_uint = c.DEFAULT_LIST,
-
@@ -371,7 +379,7 @@ help: void,version: void, poll: void, report: ReportOptions, wait: void, wait: WaitOptions, list: ListOptions, pub fn parseArg(self: *@This(), arg: []const u8, args: *std.process.ArgIterator) ParseArgsError!void {
-
@@ -380,7 +388,7 @@ .help => return ParseArgsError.UnknownArg,.version => return ParseArgsError.UnknownArg, .poll => return ParseArgsError.UnknownArg, .report => try self.report.parseArg(arg, args), .wait => return ParseArgsError.UnknownArg, .wait => try self.wait.parseArg(arg, args), .list => try self.list.parseArg(arg, args), } }
-
@@ -412,7 +420,7 @@ .report => {self.command = .{ .report = .{} }; }, .wait => { self.command = .wait; self.command = .{ .wait = .{} }; }, .list => { self.command = .{ .list = .{} };
-
@@ -725,6 +733,7 @@ };const event_type: EventType = switch (self.command) { .list => |opts| opts.event_type orelse .both, .wait => |opts| opts.event_type orelse .both, else => .both, };
-
-
-
@@ -80,9 +80,9 @@ \\wait Sleep until sunrise and/or sunset, then exits.\\report Prints sunrise and sunset times. \\list List sunrise and sunset times for next <DAYS>. \\ \\[List Options] \\[Options for "list" and "wait"] \\-e <TYPE>, --event <TYPE> \\ Events to print. Valid values are: \\ Events to print or wait. Valid values are: \\ * sunrise \\ * sunset \\ When this option is not set, sunwait targets both.
-
@@ -179,8 +179,18 @@ c.generate_report(&c_opts);return ExitCode.ok.code(); }, .wait => { std.log.err("wait command is not implemented", .{}); return ExitCode.generic_error.code(); var c_opts = opts.toC(); const code = c.sunwait(&c_opts); switch (code) { c.EXIT_OK => return ExitCode.ok.code(), c.EXIT_ERROR => return ExitCode.generic_error.code(), else => { std.log.err("Unexpected exit code from sunwait(): {d}", .{code}); return ExitCode.generic_error.code(); }, } }, } }
-