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
Update docker commands. #940
Conversation
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.
Thanks, looks good, I've added a few review comments.
thefuck/rules/docker_not_command.py
Outdated
if which('docker'): | ||
get_docker_commands = cache(which('docker'))(get_docker_commands) | ||
|
||
|
||
@sudo_support | ||
def get_new_command(command): | ||
if 'Usage:' in command.output and len(command.script_parts) > 1: | ||
management_subcommands = _parse_commands(map(lambda x: x + '\n', command.output.split('\n')), 'Commands:\n') |
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.
I think it might be better to replace map(lambda x: x + '\n', command.output.split('\n'))
with just command.output.split('\n')
and replace lambda line: line != '\n'
in :17 with lambda line: line.strip()
, so it will handle both '\n'
and ''
.
''' | ||
|
||
|
||
@pytest.fixture(autouse=True) |
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.
There's already no_memoize
fixture - https://github.com/nvbn/thefuck/blob/master/tests/conftest.py#L17
I appreciate the suggestions, @nvbn. |
Cool, thanks! |
* Add: Tests for newer version docker support. * Add: Support for newer versions of docker (Modified rules.docker_not_command). * Fix: Updated disabling memoize. * Change: removed empty list check. * Fix: _parse_commands now uses line.strip() internally and ends_with arg now doesn't end with newline. * Change: Replaced disable_memoize in favor of no_memoize fixture. * Fix: removed unused import.
Newer version of docker outputs its result to stderr, not stdout.
Also, docker's command has been changed a lot (for example,
docker images
is nowdocker image ls
).resolve #937