-
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 choco_install rule #998
Conversation
Adds a rule to append '.install' to a chocolatey install command that failed because of a non-existent package. TODO: add support for other suffixes (.portable), find more parameter cases
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.
The rule needs a complete refactor and should be rewritten as such:
from thefuck.utils import for_app, which
@for_app("choco", "cinst")
def match(command):
return (
command.script.startswith("choco install") or "cinst" in command.script_parts
) and "Installing the following packages" in command.output
def get_new_command(command):
for script_part in command.script_parts:
if (
"choco" not in script_part
and "cinst" not in script_part
and "install" not in script_part
and not script_part.startswith("-")
and "=" not in script_part
and "/" not in script_part
):
return command.script.replace(script_part, script_part + ".install")
return []
enabled_by_default = bool(which("choco")) or bool(which("cinst"))
With a comprehensive set of test cases.
Taking all this into consideration, In the meantime, it's being labeled as invalid.
Circling back to retest Co-Authored-By: Pablo Aguiar <scorphus@gmail.com>
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.
Tests for match
are still missing. Check other tests for reference.
Thanks for your contribution, @philiparola! |
Looks good, thanks! |
Adds a rule to append '.install' to a chocolatey install command that
failed because of a non-existent package.