diff --git a/thefuck/entrypoints/fix_command.py b/thefuck/entrypoints/fix_command.py index be7be720..6946653e 100644 --- a/thefuck/entrypoints/fix_command.py +++ b/thefuck/entrypoints/fix_command.py @@ -6,7 +6,7 @@ from .. import logs, types, const from ..conf import settings from ..corrector import get_corrected_commands from ..exceptions import EmptyCommand -from ..ui import select_command, confirm_command +from ..ui import select_command from ..utils import get_alias, get_all_executables @@ -41,7 +41,7 @@ def fix_command(known_args): corrected_commands = get_corrected_commands(command) selected_command = select_command(corrected_commands) - + if selected_command: selected_command.run(command) else: diff --git a/thefuck/logs.py b/thefuck/logs.py index 98a21c81..54a856a6 100644 --- a/thefuck/logs.py +++ b/thefuck/logs.py @@ -71,6 +71,7 @@ def confirm_text(corrected_command): reset=color(colorama.Style.RESET_ALL), blue=color(colorama.Fore.BLUE))) + def double_confirm_text(confirmation_text): sys.stderr.write( (u'{prefix}{clear}{bold}{text}{reset} ' @@ -83,7 +84,7 @@ def double_confirm_text(confirmation_text): green=color(colorama.Fore.GREEN), red=color(colorama.Fore.RED), reset=color(colorama.Style.RESET_ALL), - )) + )) def debug(msg): diff --git a/thefuck/ui.py b/thefuck/ui.py index e081f54c..830a2afb 100644 --- a/thefuck/ui.py +++ b/thefuck/ui.py @@ -6,7 +6,6 @@ from .exceptions import NoRuleMatched from .system import get_key from .utils import get_alias from . import logs, const -from .types import CorrectedCommand def read_actions(): @@ -98,11 +97,11 @@ def select_command(corrected_commands): selector.next() logs.confirm_text(selector.value) - - if not (settings.require_double_confirmation and selector.value.script in const.DOUBLE_CONFIRMATION_SCRIPTS): - return selector.value - - confirmation_text = const.DOUBLE_CONFIRMATION_SCRIPTS[selector.value.script] + if settings.require_double_confirmation and selector.value.script in const.DOUBLE_CONFIRMATION_SCRIPTS: + selector.value = double_confirm(const.DOUBLE_CONFIRMATION_SCRIPTS[selector.value.script]) + + +def double_confirm(confirmation_text): logs.double_confirm_text(confirmation_text) for action in read_actions():