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.

Support --option style for arguments

See original GitHub issue

Summary 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
MartinGC94commented, Dec 19, 2021

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.

1reaction
vexx32commented, Dec 20, 2021

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 to Get-ChildItem and as such is bound by PowerShell’s rules instead.

Read more comments on GitHub >

github_iconTop 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 >

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