You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
I have searched the issue tracker for a similar issue and not found a similar issue.
General issue report
I have setup a REPL following the basic console example. For one of my commands, I want to accept negative numbers as the value. The command looks like this: set <key> <value>. When I run the command as set some_key -5 I get the following error set: invalid option "-?". I have tried escaping the - which worked, but made the number positive.
repl> set some_key \-5
I (81716) repl: Updating value to 5
I also tried wrapping the value in quotes and double escaping the - symbol with no better results.
repl> set some_key \\-5
I (199946) repl: Updating value to \-5
repl> set some_key "-5"
set: invalid option "-?"
Command returned non-zero error code: 0x1 (ERROR)
repl> set some_key "\-5"
I (224686) repl: Updating value to 5
The only way I was able to get this working was by following the cmd_nvs component from the advanced console example where the value is passed after -v or --value.
repl> set some_key -v -3
I (17196) repl: Updating value to -3
This time it worked without having to escape anything. I can use this as a workaround for the time being, but would prefer to drop the -v since you're always expected to pass a value to the set command anyways.
The only difference in code was with the args definition:
// Doesn't workstaticstruct {
structarg_str *key = arg_str1(NULL, NULL, "<key>", "Key to update");
structarg_str *value = arg_str1(NULL, NULL, "<value>", "Value to set");
structarg_end *end = arg_end(2);
} setArgs;
// Worksstaticstruct {
structarg_str *key = arg_str1(NULL, NULL, "<key>", "Key to update");
structarg_str *value = arg_str1("v", "value", "<value>", "Value to set"); // This line changedstructarg_end *end = arg_end(2);
} setArgs;
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
Minus symbol stripped from negative numbers by console component
Minus symbol stripped from negative numbers by console component (IDFGH-9497)
Feb 27, 2023
@tadejg Since the behavior is the same with argtable3 on Linux (reproducer), I would recommend reporting this upstream at https://github.com/argtable/argtable3/issues. If this issue is fixed upstream, we will update argtable3 to the latest release version.
Answers checklist.
General issue report
I have setup a REPL following the basic console example. For one of my commands, I want to accept negative numbers as the value. The command looks like this:
set <key> <value>
. When I run the command asset some_key -5
I get the following errorset: invalid option "-?"
. I have tried escaping the-
which worked, but made the number positive.I also tried wrapping the value in quotes and double escaping the
-
symbol with no better results.The only way I was able to get this working was by following the
cmd_nvs
component from the advanced console example where the value is passed after-v
or--value
.This time it worked without having to escape anything. I can use this as a workaround for the time being, but would prefer to drop the
-v
since you're always expected to pass a value to theset
command anyways.The only difference in code was with the args definition:
The text was updated successfully, but these errors were encountered: