-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't choke on switches in --example=VALUE format #6759
Conversation
Hi @viispade, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
|
||
// Try to translate short option names to their full equivalents. | ||
if (hasProperty(shortOptionNames, s)) { | ||
if (hasProperty(shortOptionNames, s.toLowerCase())) { | ||
s = shortOptionNames[s]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This no longer works correctly because shortOptionNames
uses lowercase keys
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example: tsc -V
will throw an error
Got it.
Hey @viispade, thanks for the PR. As a heads up, you're going to get linting errors in the CI build for things like using |
else { | ||
// When using long-form switches, we follow standard command-line conventions and accept | ||
// "--example=VALUE", but we also accept "--example VALUE". | ||
const longFormSwitch = s.split("=", 1).toString().toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of the toString()
, just index at 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this isn't necessarily a "long-form" so just make it optionName
ping |
Looks OK to me. @mhegazy ? |
Actually we need to agree on the underlying issue first |
What is pending? If this is awaiting Anders's input, can you say so in the issue so we all know what all is still needed? |
I think we need to decide if we want to allow the general scenario for down the line. It seems innocuous but it's still extra complexity and adds more ways to do the same thing, which arguably can make things more confusing for people. |
@viispade that's the intent of the "In Discussion" label |
I don't think my last comment was gruff, but if I try to read it in a way different from how I wrote it, I can understand that someone could interpret it that way. To be clear, I was asking for clarification about what the rubric is for the discussion so everyone can understand what the blockers are, and nothing more.
My first pass at reading this comment leaves me thinking, "Hmph. Kind of condescending..." Understanding, though, that it may have been written in a different mindset and that my reaction may not match how it was meant to be understood, I give it a more charitable reread. That turns up nothing. And it doesn't address the question I asked. If there was never any intent to accept any fix for the issue, I would have preferred being told that instead of being led to believe that the discussion was still open and being sent to change how I should approach the fix. |
I was just making a statement of fact 😿 I'm updating the FAQ to clarify what the labels on issues mean; hopefully that can reduce any future confusion. I have to note that
|
Instead of adding complexity, why not just an error message if we run into an unknown command line option with |
Issue #6758
This treats
--example=VALUE
as if you had written--example VALUE
. This follows the conventions for other tools. Compare with the output ofls --help
,cp --help
,rm --help
,mkdir --help
, etc. It's probably too late to just drop support for the second format.