Add NoNewLine switch for Out-String cmdlet#5056
Conversation
2fbea3c to
38a2f00
Compare
There was a problem hiding this comment.
Please remove extra line.
There was a problem hiding this comment.
Added braces as suggested
There was a problem hiding this comment.
Please use one line formatting as above.
There was a problem hiding this comment.
Thanks for pointing that out. Done!
There was a problem hiding this comment.
Please put NoNewLine and Sream parameters in different parameter sets as discussed in the Issue.
There was a problem hiding this comment.
Done. I have named the ParameterSets as NonStreamFormatting and StreamFormatting for want of a better name. Do suggest one if this is bad :)
I've also fixed-up the commit instead of adding a new one to keep it clean. Let me know if that is an inconvenience.
There was a problem hiding this comment.
Why we use space? I'd prefer to remove.
There was a problem hiding this comment.
I was not sure what example to give and hence followed the one in
It "Should accumulate the strings and returns them as a single string"
Will remove the space as suggested
d3a59c3 to
f17122a
Compare
|
We just need to make sure the documentation is updated to include the new parameter. |
There was a problem hiding this comment.
I'd prefer "NoNewlineFormatting".
There was a problem hiding this comment.
Nice. changing it now
There was a problem hiding this comment.
Please add the test for default parameter set:
$testArray | Out-String | Should Be "ab"
There was a problem hiding this comment.
If i am not wrong, this is the test for the default parameter set wherein newlines are added to the output. Is my understanding correct?
There was a problem hiding this comment.
Thanks! Yes, correct.
Closed.
There was a problem hiding this comment.
I think we should a test that Stream and NoNewLine in different parameter sets:
{$testarray | Out-String -NoNewLine -Stream } | ShouldBeErrorId "....."There was a problem hiding this comment.
Sure. I was a bit unsure how to go about doing that. Thanks for helping out!
f17122a to
cfd5ebd
Compare
There was a problem hiding this comment.
Please replace $($nl) with ${nl}
cfd5ebd to
eb5cb2a
Compare
There was a problem hiding this comment.
@raghav710 Thanks for your contribution! Hope to see you around more.
One side note: It's recommended to push new commits to address comments instead of squashing new fixes into the existing commit. In this way, the change history is preserved and it's very helpful for code reviews.
|
@daxian-dbw Thanks for the note. Will follow that henceforth during code reviews. As an aside, do you think it is good to squash the commits after approval as that would keep the history clean in case there were multiple code comments. |
|
@raghav710 We want keep the history while we review. Then we usually Squash and Merge for simple changes. But if the code is very complex, tricky and add big feature we keep all commits. |
|
@mklement0 We merged the PR but we can always bring Out-String and Out-File into line until RTM. |
|
Yaay! |
Fix #3684.
First PS pull request {insert nervous emoji}
Mostly adapted from the -NoNewLine changes for Out-File