Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Any misspelling in "gh isssue" command params leads to new Issue been created. #414

Closed
Restuta opened this issue Oct 9, 2015 · 4 comments

Comments

@Restuta
Copy link

Restuta commented Oct 9, 2015

gh --version
1.11.13

E.g. if I run command gh is --labels task new issue will be created, while I just mis-added "s" at the end of "labels" and correct command would be gh is --label task.

This is very annoying especially given the fact that GitHub doesn't allow to delete issues.

@henvic
Copy link
Member

henvic commented Oct 9, 2015

I am sorry this is happening to you. This is by design / "as expected". How many times does it happen to you?

If you find it very disturbing and it happens a lot maybe it's a good idea for gh to calculate the word distance to '--missed-commands' or something to make auto-correction & avoid the default action from happening.

Funny thing is someone told me something very similar to this, but the effect was actually what he wanted (but just because he wanted the default command).

@Restuta
Copy link
Author

Restuta commented Oct 10, 2015

@henvic 3 times today. Now I have uncomfortable fear of using this command =)

Can you elaborate a little more? What this design actually brings compared to "if some unusual arguments has been provided – don't do anything but output error message"?

@henvic
Copy link
Member

henvic commented Oct 11, 2015

Yes.

First, gh uses nopt to process the arguments called on the program execution.

Then we get an object with some interpreted data (for example, shortcuts are translated and so on).

We have two categories of arguments. One called options, the other commands. All commands are options. The subtle difference is that commands map to operations we do (i.e., open, create, new, delete), while non-commands only say something to be used inside the operations (i.e., issue number).

Some modules use default commands. For them, when we don't identify a command, we try to see if a pattern matches. Something like this:

  • no module arguments: invoke command x (as if --x had been passed)
  • 1 module arguments: invoke command y (as if --y had been passed)
  • 2+ module arguments: invoke command z (as if --z had been passed)
  • by module I mean any of the gh's modules such as issues, pull-requests, alias, notification, or repo.

@protoEvangelion
Copy link
Member

@Restuta Please let me know if you would like to continue the conversation on this 😉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants