aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/cli.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-10-18 19:10:17 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-10-18 19:10:17 -0400
commit89fd5759a2ddd06aa4ddacc238efbfa99eddda84 (patch)
tree39948853bfeacbb5d39547cfe503ab796893a10d /src/stdlib/cli.c
parentc3e2e78121ac357ed7c617c29b8b342101ecf1e0 (diff)
Don't skip backslash for args with `\-` after the `--`
Diffstat (limited to 'src/stdlib/cli.c')
-rw-r--r--src/stdlib/cli.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/stdlib/cli.c b/src/stdlib/cli.c
index 47cac2e1..22ed9b94 100644
--- a/src/stdlib/cli.c
+++ b/src/stdlib/cli.c
@@ -198,10 +198,12 @@ static List_t parse_arg_list(List_t args, const char *flag, void *dest, const Ty
const char *arg = *(const char **)args.data;
- if ((type->tag == TextInfo || type == &CString$info) && arg[0] == '\\' && arg[1] == '-') {
- arg = arg + 1;
- } else if (arg[0] == '-' && !allow_dashes) {
- print_err("Not a valid argument for flag ", flag, ": ", arg);
+ if (!allow_dashes) {
+ if ((type->tag == TextInfo || type == &CString$info) && arg[0] == '\\' && arg[1] == '-') {
+ arg = arg + 1;
+ } else if (arg[0] == '-') {
+ print_err("Not a valid argument for flag ", flag, ": ", arg);
+ }
}
if (type->tag == OptionalInfo) {