diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-06-14 23:59:01 -0400 |
|---|---|---|
| committer | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-06-14 23:59:01 -0400 |
| commit | c3acdeb310c1426d009004956c1b3e59e4920808 (patch) | |
| tree | dc0b95af9c9789bdc6d2ac17dea0cc1ad9da42b5 /core/flags | |
| parent | edb685f04be9aef407dc8abac7bb76fb51184f9f (diff) | |
Add `--` parsing to UNIX-style `core:flags`
This will allow a user to indicate all arguments after `--` are parsed
into the variadic array.
Diffstat (limited to 'core/flags')
| -rw-r--r-- | core/flags/internal_parsing.odin | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/flags/internal_parsing.odin b/core/flags/internal_parsing.odin index 349afdd29..7a769b17c 100644 --- a/core/flags/internal_parsing.odin +++ b/core/flags/internal_parsing.odin @@ -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 |