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
Describe the scenario
If shell is used to implement AT commands, some commands are parsed incorrectly. It is because shell argument parser attempts to extract all parameters into separate strings and support quotation characters so it parses string like command arg1 "arg2 with spaces" into 3 arguments with last one containing spaces. Quotations must be escaped if they are just quotations (e.g. command arg1\"ABC\"). For AT case it would actually be more convenient if shell passes parameters as single string to the command handler.
Example (assuming that at is a registered command with handler):
command: at AT+ABC="some string","FOO", "foo"
Now is parsed as: argv[0]=at argv[1]=AT+ABC=some string,FOO, argv[2]=foo
Proposed solution
Add flags to command registration and flag that will tell the parser to treat all characters following n'th argument as the last argument.
Add flag SHELL_CMD_MERGE_ARGS(offset). Offset written on 4 bits should be more than enough.
Extend registration command to allow passing flags.
The text was updated successfully, but these errors were encountered:
@nordic-krch : The easiest way, in my opinion, would be to implement a command like select which you can use to dynamically modify parameter set by Kconfig's SHELL_ARGC_MAX.
And similar to select you could use some escape code to bring back default value.
By executing command:
set_argc_max 1 // new command to be implemented
Shell command at AT+ABC="some string","FOO", "foo" will be interpreted as expected:
Describe the scenario
If shell is used to implement AT commands, some commands are parsed incorrectly. It is because shell argument parser attempts to extract all parameters into separate strings and support quotation characters so it parses string like
command arg1 "arg2 with spaces"
into 3 arguments with last one containing spaces. Quotations must be escaped if they are just quotations (e.g.command arg1\"ABC\"
). For AT case it would actually be more convenient if shell passes parameters as single string to the command handler.Example (assuming that
at
is a registered command with handler):command:
at AT+ABC="some string","FOO", "foo"
Now is parsed as:
argv[0]=at
argv[1]=AT+ABC=some string,FOO,
argv[2]=foo
Expected:
argv[0]=at
argv[1]=AT+ABC="some string","FOO", "foo"
Proposed solution
Add flags to command registration and flag that will tell the parser to treat all characters following n'th argument as the last argument.
Add flag
SHELL_CMD_MERGE_ARGS(offset)
. Offset written on 4 bits should be more than enough.Extend registration command to allow passing
flags
.The text was updated successfully, but these errors were encountered: