-
Notifications
You must be signed in to change notification settings - Fork 3.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
Add: rules/go_unknown_command for misspelled go commands. #933
Conversation
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.
So obviously I missed the test for |
…et_new_command method.
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.
Sorry for slow response. It looks good, I've a few things that will be nice to improve =)
thefuck/rules/go_unknown_command.py
Outdated
@@ -0,0 +1,18 @@ | |||
from thefuck.utils import get_closest, replace_argument | |||
|
|||
_GOLANG_COMMANDS = ( |
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.
Can you please make that list dynamic, like in /~https://github.com/nvbn/thefuck/blob/master/thefuck/rules/gem_unknown_command.py#L17 ?
thefuck/rules/go_unknown_command.py
Outdated
|
||
def match(command): | ||
return (command.script_parts | ||
and command.script_parts[0] == "go" |
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.
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):
...
Done. |
Awesome, thanks! |
* - 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.