common: standardize on -help option

Also:

- Check for -help option *before* unknown options
- Use common flags parsing code for riverctl
- Add usage text to riverctl
This commit is contained in:
Isaac Freund
2021-07-24 19:31:04 +02:00
parent a5a505ecba
commit 23088b800c
5 changed files with 60 additions and 31 deletions

View File

@ -85,7 +85,7 @@ pub fn parse(args: [][*:0]const u8, comptime flags: []const Flag) !ParseResult(f
.arg => {
arg_idx += 1;
if (arg_idx == args.len) {
std.log.err("flag '" ++ flag.name ++
std.log.err("option '" ++ flag.name ++
"' requires an argument but none was provided!", .{});
return error.MissingFlagArgument;
}