Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

"-"-prefixed barewords in argument mode should always be interpreted as parameter names #4591

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

#4578 shows that you can sometimes use --prefixed bareword as parameter values - namely only if the bareword happens not to (prefix)-match a parameter name of the target command - and when such barewords are recognized as values, they don't behave the same way as non---prefixed barewords with respect to interpolation and being recognized as a single argument.

This inconsistency is problematic.

Given, @lzybkr's comment at #4576 (comment)

The "workaround" is in my opinion the preferred style - use quotes.

it seems that the desired solution is to disallow --prefixed barewords as values and to always assume that such an unquoted --prefixed token is a parameter name.

# Currently interpreted as *value*, because no Write-Output parameter name starts with -z.
# This should no longer be supported.
> Write-Output -InputObject -z
-z

# Interpreted as *parameter name*, because -n prefix-matches parameter -NoEnumeration
> Write-Output -InputObject -n
Write-Output : Missing an argument for parameter 'InputObject'. Specify a parameter of type 'System.Management.Automation.PSObject[]' and try again.

Environment data

PowerShell Core v6.0.0-beta.5
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-AnsweredThe question is answered.The question is answered.WG-Languageparser, language semanticsparser, language semantics

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.