question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parameter Naming Inconsistancy: Option vs. Options

See original GitHub issue
PS C:\> New-Variable -Name x -Value 'Read-only variable' -Option ReadOnly
PS C:\> New-Item -Path Function:\xf -Value {'Does nothing'} -Options ReadOnly | Out-Null

Expected behavior

The expected behavior is that both parameters would have been named “Option” (singular) in both cmdlets, regardless of the PS Provider, and whether or not a parameter is dynamic. Were this type of discrepancy found in more places in Microsoft delivered code, even as small as this is, it may have had a largely negative impact on PowerShell overall. I do understand that, “The data stores that the provider exposes can be as varied as Active Directory location and Microsoft Exchange Server mailboxes.” Even so, this seems like a small, non-breaking change. That said, this change would require edits to About Providers, and Function provider.

Actual behavior

“Option” and “Options” are both used for the same parameter on different cmdlets (different PS Providers). Each parameter includes the identical arguments, or parameter values: AllScope, Constant, None, Private, ReadOnly, Unspecified.

Environment data

Name                           Value
----                           -----
PSVersion                      6.2.3
PSEdition                      Core
GitCommitId                    6.2.3
OS                             Microsoft Windows 10.0.18362 
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
iSazonovcommented, Sep 17, 2019

@vexx32 Not binding, I updated my comment. See #3307

0reactions
iSazonovcommented, Sep 18, 2019

the code the fix needs to be, no?

I’m not sure yet. I did not find a description in the documentation. This is also a problem. And I did not find this code. Therefore, it is not yet clear what intentions were under the design. Provider code always very sensitive.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Name conventions for options - tidyverse
So, Is there an established convention for option names ... Variable and function names should use only lowercase letters, numbers, and _ ....
Read more >
bash - Difference between terms: "option", "argument", and ...
A parameter is an argument that provides information to either the command or one of its options, e.g. in -o file , file...
Read more >
How to Better Name Your Functions and Variables
When naming a function, variable or class, you should keep the following things in mind: Choose a word with meaning (provide some context) ......
Read more >
Parameters and Selection-Option
Hi,. All these are standard naming conventions. P stands for Paramater. S Stands for Select Options. Similarly there are many naming conventions ...
Read more >
Naming convention (programming)
In computer programming, a naming convention is a set of rules for choosing the character sequence to be used for identifiers which denote...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found