mirror of
https://github.com/nvbn/thefuck.git
synced 2025-04-22 02:25:19 +01:00
* add docker container removal * remove container before deleting image * update readme * clean up and add assert not test * test not docker command * use shell.and_ correctly
21 lines
631 B
Python
21 lines
631 B
Python
from thefuck.utils import for_app
|
|
from thefuck.shells import shell
|
|
|
|
|
|
@for_app('docker')
|
|
def match(command):
|
|
'''
|
|
Matches a command's output with docker's output
|
|
warning you that you need to remove a container before removing an image.
|
|
'''
|
|
return 'image is being used by running container' in command.output
|
|
|
|
|
|
def get_new_command(command):
|
|
'''
|
|
Prepends docker container rm -f {container ID} to
|
|
the previous docker image rm {image ID} command
|
|
'''
|
|
container_id = command.output.strip().split(' ')
|
|
return shell.and_('docker container rm -f {}', '{}').format(container_id[-1], command.script)
|