fix: fallback to treating cli args with colons as plain filenames
This allows us to open files that contain colons if they do not otherwise look like file:row:col. This also fixes opening absolute file paths on Windows.
This commit is contained in:
parent
4d8d538c9a
commit
805003cc77
1 changed files with 10 additions and 5 deletions
|
@ -181,12 +181,17 @@ pub fn main() anyerror!void {
|
|||
var it = std.mem.splitScalar(u8, arg, ':');
|
||||
curr.file = it.first();
|
||||
if (it.next()) |line_|
|
||||
curr.line = std.fmt.parseInt(usize, line_, 10) catch null;
|
||||
curr.line = std.fmt.parseInt(usize, line_, 10) catch blk: {
|
||||
curr.file = arg;
|
||||
break :blk null;
|
||||
};
|
||||
if (curr.line) |_| {
|
||||
if (it.next()) |col_|
|
||||
curr.column = std.fmt.parseInt(usize, col_, 10) catch null;
|
||||
if (it.next()) |col_|
|
||||
curr.end_column = std.fmt.parseInt(usize, col_, 10) catch null;
|
||||
}
|
||||
}
|
||||
|
||||
for (dests.items) |dest| {
|
||||
if (dest.file.len == 0) continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue