M0.9: allow literal dash-prefixed CLI filenames

This commit is contained in:
Mex
2026-10-20 21:25:49 +02:00
committed by GitHub
parent d9c924c3ba
commit df5ffec87b
5 changed files with 68 additions and 15 deletions
+4
View File
@@ -18,6 +18,10 @@ impl Args {
let mut a = Args::default();
let mut it = argv.iter();
while let Some(arg) = it.next() {
if arg == "--" {
a.positional.extend(it.cloned());
break;
}
let name = if let Some(n) = arg.strip_prefix("--") {
n
} else if let Some(n) = arg.strip_prefix('-').filter(|n| n.len() == 1 && !n.starts_with(|c: char| c.is_ascii_digit())) {