feat: add --literal
cli option to disable file name parsing for line numbers
This commit is contained in:
parent
53843797f0
commit
47dd41bdf6
1 changed files with 20 additions and 13 deletions
|
@ -64,6 +64,7 @@ pub fn main() anyerror!void {
|
||||||
.no_syntax = "Disable syntax highlighting",
|
.no_syntax = "Disable syntax highlighting",
|
||||||
.syntax_report_timing = "Report syntax highlighting time",
|
.syntax_report_timing = "Report syntax highlighting time",
|
||||||
.exec = "Execute a command on startup",
|
.exec = "Execute a command on startup",
|
||||||
|
.literal = "Disable :LINE and +LINE syntax",
|
||||||
.version = "Show build version and exit",
|
.version = "Show build version and exit",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -74,6 +75,7 @@ pub fn main() anyerror!void {
|
||||||
.trace_level = 't',
|
.trace_level = 't',
|
||||||
.language = 'l',
|
.language = 'l',
|
||||||
.exec = 'e',
|
.exec = 'e',
|
||||||
|
.literal = 'L',
|
||||||
.version = 'v',
|
.version = 'v',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -92,6 +94,7 @@ pub fn main() anyerror!void {
|
||||||
no_syntax: bool,
|
no_syntax: bool,
|
||||||
syntax_report_timing: bool,
|
syntax_report_timing: bool,
|
||||||
exec: ?[]const u8,
|
exec: ?[]const u8,
|
||||||
|
literal: bool,
|
||||||
version: bool,
|
version: bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -211,7 +214,7 @@ pub fn main() anyerror!void {
|
||||||
for (positional_args.items) |arg| {
|
for (positional_args.items) |arg| {
|
||||||
if (arg.len == 0) continue;
|
if (arg.len == 0) continue;
|
||||||
|
|
||||||
if (arg[0] == '+') {
|
if (!args.literal and arg[0] == '+') {
|
||||||
const line = try std.fmt.parseInt(usize, arg[1..], 10);
|
const line = try std.fmt.parseInt(usize, arg[1..], 10);
|
||||||
if (prev) |p| {
|
if (prev) |p| {
|
||||||
p.line = line;
|
p.line = line;
|
||||||
|
@ -228,6 +231,7 @@ pub fn main() anyerror!void {
|
||||||
curr.line = line;
|
curr.line = line;
|
||||||
line_next = null;
|
line_next = null;
|
||||||
}
|
}
|
||||||
|
if (!args.literal) {
|
||||||
var it = std.mem.splitScalar(u8, arg, ':');
|
var it = std.mem.splitScalar(u8, arg, ':');
|
||||||
curr.file = it.first();
|
curr.file = it.first();
|
||||||
if (it.next()) |line_|
|
if (it.next()) |line_|
|
||||||
|
@ -241,6 +245,9 @@ pub fn main() anyerror!void {
|
||||||
if (it.next()) |col_|
|
if (it.next()) |col_|
|
||||||
curr.end_column = std.fmt.parseInt(usize, col_, 10) catch null;
|
curr.end_column = std.fmt.parseInt(usize, col_, 10) catch null;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
curr.file = arg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var have_project = false;
|
var have_project = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue