common/flags: make argFlag() return a slice

We always pass the result of this to mem.span() currently, no need for
the code duplication.
This commit is contained in:
Isaac Freund
2021-12-15 17:09:45 +01:00
parent d93ee2c27e
commit c3370afa3d
3 changed files with 11 additions and 9 deletions

View File

@ -67,7 +67,7 @@ pub fn main() anyerror!void {
os.exit(0);
}
if (result.argFlag("-log-level")) |level_str| {
const level = std.meta.stringToEnum(LogLevel, std.mem.span(level_str)) orelse {
const level = std.meta.stringToEnum(LogLevel, level_str) orelse {
std.log.err("invalid log level '{s}'", .{level_str});
try io.getStdErr().writeAll(usage);
os.exit(1);
@ -81,7 +81,7 @@ pub fn main() anyerror!void {
}
const startup_command = blk: {
if (result.argFlag("-c")) |command| {
break :blk try util.gpa.dupeZ(u8, std.mem.span(command));
break :blk try util.gpa.dupeZ(u8, command);
} else {
break :blk try defaultInitPath();
}