Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Butterfly CLI should allow escaped semicolons and equals as extension property value when passed using -p #360

Closed
fabiocarvalho777 opened this issue Oct 12, 2020 · 6 comments
Assignees
Milestone

Comments

@fabiocarvalho777
Copy link
Member

fabiocarvalho777 commented Oct 12, 2020

See issue #167 for context. Currently any semicolon passed to Butterfly CLI using -p will always be used to separate properties. Similarly, equals will always be used to separate property name from property value.

However, both should also be allowed as property value, as long as escaped when using -p.

@fabiocarvalho777 fabiocarvalho777 changed the title Butterfly CLI should allow escaped semicolons as extension property value when passed using -p Butterfly CLI should allow escaped semicolons and equals as extension property value when passed using -p Oct 12, 2020
@badalsarkar
Copy link
Contributor

Hello,
I would like to work on this issue.
I am assuming the following scenario-
-pkey1=value1;key2=value2 should return key1 = value1 and key2 = value2
-pkey1=value\;1;key2=value\;2 should return key1 = value;1 and key2 = value;2
-pkey1=value\=1;key2=value\=2 should return key1 = value=1 and key2 = value=2

Please let me know if I am getting it right.

@fabiocarvalho777
Copy link
Member Author

Hello @badalsarkar
Yes, you got it right.
Thanks!

@badalsarkar
Copy link
Contributor

Hi @fabiocarvalho777
I have figured out a solution. Changing
try (StringReader stringReader = new StringReader(inlineProperties.replace(';', '\n'))) {

in this file to

try (StringReader stringReader = new StringReader(inlineProperties.replaceAll("(?<!\\\\);", "\n"))) {

should produce the desired result.

But how do I go about testing it? Should I add new test and in which file?

Thanks.

@fabiocarvalho777
Copy link
Member Author

@badalsarkar please, add a unit test class named ButterflyCliRunnerTest here and add your tests there.

Thanks!!

fabiocarvalho777 pushed a commit that referenced this issue Oct 28, 2020
Butterfly CLI  option `-p` uses semi-colon to separate properties and
equals to separate property from value. Now, the option '-p' accepts
escaped semi-colon and equals as property value. Example `-p
firstkey=value\;1;secondkey=value\;2`
@fabiocarvalho777 fabiocarvalho777 added this to the 3.1.0 milestone Oct 28, 2020
@fabiocarvalho777
Copy link
Member Author

@badalsarkar I have just merged your PR. Thank you very much for your contribution :-)

@badalsarkar
Copy link
Contributor

@fabiocarvalho777 , it was great to contribute. Thank you.

fabiocarvalho777 pushed a commit that referenced this issue Jun 11, 2021
Butterfly CLI  option `-p` uses semi-colon to separate properties and
equals to separate property from value. Now, the option '-p' accepts
escaped semi-colon and equals as property value. Example `-p
firstkey=value\;1;secondkey=value\;2`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants