Automatically split | characters to a new line
See original GitHub issueSummary of the new feature/enhancement
I’d like to the ability to take the following line:
$Ports | ForEach-Object -Process { NETSTAT.EXE -ano | findstr.exe :8080 | ForEach-Object -Process { ($_ -split '\s+')[-1] } | Sort-Object | Get-Unique | ForEach-Object -Process { taskkill.exe /F /PID $_ } }
and convert it to:
$Ports |
ForEach-Object -Process {
NETSTAT.EXE -ano |
findstr.exe :8080 |
ForEach-Object -Process {
($_ -split '\s+')[-1]
} | Sort-Object |
Get-Unique |
ForEach-Object -Process {
taskkill.exe /F /PID $_
}
}
I think this would go a long way in approving readability. At the very least, with the
"powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline"
setting enabled, when I manually add the new line after each | and }, it will format the indentation correctly which is nice.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Split string using a newline delimiter with Python [duplicate]
If you want to split only by newlines, you can use str.splitlines(): ... data.split() # split automatically splits through \n and space ['a,b,c',...
Read more >Split Java String by Newline | Baeldung
In this tutorial, we'll look at different ways to split a Java String by newline characters. Since the newline character is different in ......
Read more >How to Split Multiple Lines in a Cell into a Separate Cells ...
Learn how to spit multiple lines in a single cell into different cells using Text to Columns functionality. You need to use Control...
Read more >Split a String - Online String Tools
Simple, free and easy to use online tool that splits strings. No intrusive ads, popups or nonsense, just a string splitter. Load a...
Read more >JavaScript - split string by new line character - Dirask
In this article, we're going to have a look at the problem of how to split string to separate lines in JavaScript. Note:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Done. I created the issue here: https://github.com/PowerShell/PSScriptAnalyzer/issues/1345
in the meantime, should this issue be closed?
Thanks for transferring the issue, yes, we can close here. Should that new setting be implemented in PSSA, it should be natural to the implementer that PRs would later be needed here and in PSES to propagate the setting.