Support for multi-line invocations without using parameter splatting or ` #11551
Labels
Issue-Enhancement
the issue is more of a feature request than a bug
Resolution-Duplicate
The issue is a duplicate.
Summary of the new feature/enhancement
Allow invocations that are wrapped in parentheses to span multiple lines, eg:
Problem
Currently there are two dominant ways to do a multi-line invocation in powershell:
Backtick line-continuations
This is problematic because it's whitespace-sensitive and prevents using # for line-comments.
Splatting
this creates the problem that you lose intellisense and validation since you've decoupled the parameters from their corresponding command.
Summary
There are no good ways to do multiline invocations in Powershell.
Proposal
Let the humble parenthesis handle it. Currently, this:
(Invoke-MyCommandlet -arg1 "foo" -arg2 "bar" -arg3 "baz")
is valid powershell, but this:
is not valid. But why not? The open-parens clearly identifies that we're starting something that should not end until we see a close-parens. Why not, then, allow it to span multiple lines?
The text was updated successfully, but these errors were encountered: