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 committed 2024-06-14 23:59:01 -04:00
1 parent edb685f04b
commit c3acdeb310
2 files changed
+35

No files matched your search

+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