From 88732a608e71e1af42f8dd73030d90c6d8aaba34 Mon Sep 17 00:00:00 2001 From: mcarton Date: Fri, 31 Jul 2015 21:48:14 +0200 Subject: [PATCH] Adapt the `tmux` rule to #324 --- tests/rules/test_tmux.py | 2 +- thefuck/rules/tmux.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/rules/test_tmux.py b/tests/rules/test_tmux.py index ebbe6736..963e9f1d 100644 --- a/tests/rules/test_tmux.py +++ b/tests/rules/test_tmux.py @@ -16,4 +16,4 @@ def test_match(tmux_ambiguous): def test_get_new_command(tmux_ambiguous): assert get_new_command(Command('tmux list', stderr=tmux_ambiguous), None)\ - == 'tmux list-keys' + == ['tmux list-keys', 'tmux list-panes', 'tmux list-windows'] diff --git a/thefuck/rules/tmux.py b/thefuck/rules/tmux.py index 719e8208..d58ae37a 100644 --- a/thefuck/rules/tmux.py +++ b/thefuck/rules/tmux.py @@ -1,4 +1,4 @@ -from thefuck.utils import get_closest, replace_argument +from thefuck.utils import get_closest, replace_command import re @@ -15,6 +15,4 @@ def get_new_command(command, settings): old_cmd = cmd.group(1) suggestions = [cmd.strip() for cmd in cmd.group(2).split(',')] - new_cmd = get_closest(old_cmd, suggestions) - - return replace_argument(command.script, old_cmd, new_cmd) + return replace_command(command, old_cmd, suggestions)