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

Add: rules/go_unknown_command for misspelled go commands. #933

Merged
merged 5 commits into from
Aug 21, 2019
Merged

Add: rules/go_unknown_command for misspelled go commands. #933

merged 5 commits into from
Aug 21, 2019

Conversation

ik1ne
Copy link
Contributor

@ik1ne ik1ne commented Jul 19, 2019

  • Add: rules/go_unknown_command for misspelled go commands.
  • Add: tests/test_go_unknown_command which tests match and mismatch case of rules/go_unknown_command.
  • Change: Added description of go_unknown_command to README.md.

- Add: tests/test_go_unknown_command which tests match and mismatch case of rules/go_unknown_command.
- Change: Added description of go_unknown_command to README.md.
@ik1ne
Copy link
Contributor Author

ik1ne commented Jul 19, 2019

So obviously I missed the test for get_new_command, I'm going to add test for that and update the PR.

Copy link
Owner

@nvbn nvbn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for slow response. It looks good, I've a few things that will be nice to improve =)

@@ -0,0 +1,18 @@
from thefuck.utils import get_closest, replace_argument

_GOLANG_COMMANDS = (
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


def match(command):
return (command.script_parts
and command.script_parts[0] == "go"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be better to replace that check with for_app decorator, it helps with things like sudo:

from thefuck.utils import for_app

@for_app('go')
def match(command):
    ...

@ik1ne
Copy link
Contributor Author

ik1ne commented Aug 20, 2019

Done.

@nvbn nvbn merged commit d88454a into nvbn:master Aug 21, 2019
@nvbn
Copy link
Owner

nvbn commented Aug 21, 2019

Awesome, thanks!

scorphus added a commit to scorphus/thefuck that referenced this pull request Jul 29, 2021
riley-martine pushed a commit to riley-martine/thefuck that referenced this pull request Dec 7, 2023
* - Add: rules/go_unknown_command for misspelled go commands.
- Add: tests/test_go_unknown_command which tests match and mismatch case of rules/go_unknown_command.
- Change: Added description of go_unknown_command to README.md.

* Add: test_get_new_command for testing rules.go_unknown_command.test_get_new_command method.

* Change: go_unknown_command.match now uses for_app decorator.

* Add: get_golang_commands which dynamically gets golang possible commands.

* Fix: cache proper function instead of its result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants