Skip to content

Conversation

@ik1ne
Copy link
Contributor

@ik1ne ik1ne commented Aug 2, 2019

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 now docker image ls).

resolve #937

@ik1ne ik1ne marked this pull request as ready for review August 5, 2019 07:13
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.

Thanks, looks good, I've added a few review comments.

@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')
Copy link
Owner

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)
Copy link
Owner

Choose a reason for hiding this comment

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

@ik1ne
Copy link
Contributor Author

ik1ne commented Aug 20, 2019

I appreciate the suggestions, @nvbn.
Modified all parts suggested and push completed.

@nvbn
Copy link
Owner

nvbn commented Aug 21, 2019

Cool, thanks!

@nvbn nvbn merged commit 1683f45 into nvbn:master Aug 21, 2019
@ik1ne ik1ne deleted the docker_latest_fix branch August 22, 2019 00:55
riley-martine pushed a commit to riley-martine/thefuck that referenced this pull request Dec 7, 2023
* 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.
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.

rules.docker_not_command works only in test environment.

2 participants