Skip to content
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

Closed
wants to merge 6 commits into from
Closed

Don't choke on switches in --example=VALUE format #6759

wants to merge 6 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jan 30, 2016

Issue #6758

This treats --example=VALUE as if you had written --example VALUE. This follows the conventions for other tools. Compare with the output of ls --help, cp --help, rm --help, mkdir --help, etc. It's probably too late to just drop support for the second format.

@msftclas
Copy link

Hi @viispade, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. Real humans will now evaluate your PR.

TTYL, MSBOT;


// Try to translate short option names to their full equivalents.
if (hasProperty(shortOptionNames, s)) {
if (hasProperty(shortOptionNames, s.toLowerCase())) {
s = shortOptionNames[s];
Copy link
Member

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

Copy link
Author

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.

@DanielRosenwasser
Copy link
Member

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 var instead of let and const. Just fix those up (run jake lint) and that should fix things right up.

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();
Copy link
Member

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.

Copy link
Member

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

@ghost
Copy link
Author

ghost commented Feb 8, 2016

ping

@RyanCavanaugh
Copy link
Member

Looks OK to me. @mhegazy ?

@RyanCavanaugh
Copy link
Member

Actually we need to agree on the underlying issue first

@ghost
Copy link
Author

ghost commented Feb 8, 2016

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?

@DanielRosenwasser
Copy link
Member

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.

@RyanCavanaugh
Copy link
Member

@viispade that's the intent of the "In Discussion" label

@ghost
Copy link
Author

ghost commented Feb 9, 2016

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.

@viispade that's the intent of the "In Discussion" label

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.

@ghost ghost closed this Feb 9, 2016
@RyanCavanaugh
Copy link
Member

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 contributing.md says

A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team

@mhegazy
Copy link
Contributor

mhegazy commented Feb 9, 2016

Instead of adding complexity, why not just an error message if we run into an unknown command line option with = in it (the user is trying --v=x). something like unsupported option format '{0}={1}', use '--{0} {1}' instead.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants