Skip to content

Commit

Permalink
[chip-tool] Make sure the multiple arguments separator for multiple w… (
Browse files Browse the repository at this point in the history
#20492)

* [chip-tool] Make sure the multiple arguments separator for multiple write onto a single transation does not collide with the comma separator from the argument value itself (#20413)

* Restyled by clang-format (#20493)

Co-authored-by: Restyled.io <[email protected]>

Co-authored-by: Vivien Nicolas <[email protected]>
Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com>
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
4 people authored Jul 9, 2022
1 parent 01db0fb commit caf62f7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/chip-tool/commands/common/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,11 @@ bool Command::InitArgument(size_t argIndex, char * argValue)
while (ss.good())
{
std::string valueAsString;
getline(ss, valueAsString, ',');
// By default the parameter separator is ";" in order to not collapse with the argument itself if it contains commas
// (e.g a struct argument with multiple fields). In case one needs to use ";" it can be overriden with the following
// environment variable.
constexpr const char * kSeparatorVariable = "CHIPTOOL_CUSTOM_ARGUMENTS_SEPARATOR";
getline(ss, valueAsString, getenv(kSeparatorVariable) ? getenv(kSeparatorVariable)[0] : ';');

CustomArgument * customArgument = new CustomArgument();
vectorArgument->push_back(customArgument);
Expand Down

0 comments on commit caf62f7

Please sign in to comment.