Add -- parsing to UNIX-style core:flags

This will allow a user to indicate all arguments after `--` are parsed
into the variadic array.
This commit is contained in:
Feoramund
2024-06-14 23:59:01 -04:00
parent edb685f04b
commit c3acdeb310
2 changed files with 35 additions and 0 deletions
+8
View File
@@ -90,6 +90,14 @@ parse_one_unix_arg :: proc(model: ^$T, parser: ^Parser, arg: string) -> (
if strings.has_prefix(arg, "-") {
// Allow `--` to function as `-`.
arg = arg[1:]
if len(arg) == 0 {
// `--`, and only `--`.
// Everything from now on will be treated as an argument.
future_args = max(int)
current_flag = INTERNAL_VARIADIC_FLAG
return
}
}
flag: string