Support --option style for arguments
See original GitHub issueSummary of the new feature / enhancement
For compatibility with Bash, and Linux CLI commands I recommend supporting --option
style for augments when the specified option
exactly matches the parameter name. This should not conflict with the way powershell currently parses arguments.
For example, ls --directory
currently fails with an error. This proposal is to allow this command since directory
parameter exactly matches the parameter.
Proposed technical implementation details (optional)
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
GNU tar 1.34.90: 3.3 The Three Option Styles
Some options must take an argument(2). Where you place the arguments generally depends on which style of options you choose. We will detail...
Read more >Short/long options with option argument - is this some sort ...
All sensible option systems use an option consisting of double-dash (' -- ') alone to mean "end of options" - the following arguments...
Read more >Positional arguments vs options in a command-line interface
The first is a "positional argument design" and the second a "command-line option design". I tend to prefer the "command-line option design" for ......
Read more >Conventions for Command Line Options
This technique is used to create another category, optional option arguments. The option's argument can be optional but still unambiguous so ...
Read more >argparse — Parser for command-line options, arguments ...
ArgumentParser objects allow the help formatting to be customized by specifying an alternate formatting class. Currently, there are four such classes:.
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
This would actually be a breaking change. This syntax is currently treated like a positional parameter, so in your example it would be bound to Path and Get-ChildItem would look for an item called --directory in the current directory.
There’s nothing stopping you from using
--option
style parameters when using command-line applications, if they support that style of option. In my opinion, it’s unlikely PowerShell is going to change its parameter styling to match, though.If you’re running on Linux where there is an actual
ls
executable, that would work as expected afaik. On Windows that is an alias that maps toGet-ChildItem
and as such is bound by PowerShell’s rules instead.