diff --git a/tests/rules/test_adb_unknown_command.py b/tests/rules/test_adb_unknown_command.py index 92534c30..f2c32562 100644 --- a/tests/rules/test_adb_unknown_command.py +++ b/tests/rules/test_adb_unknown_command.py @@ -34,7 +34,7 @@ def test_not_match(script): @pytest.mark.parametrize('script, new_command', [ ('adb puhs test.bin /sdcard/test.bin', 'adb push test.bin /sdcard/test.bin'), ('adb -s 1111 logcta', 'adb -s 1111 logcat'), - ('adb -p 666 pulll /sdcard/test.bin', 'adb -p 666 pull /sdcard/test.bin'), + ('adb -P 666 pulll /sdcard/test.bin', 'adb -P 666 pull /sdcard/test.bin'), ('adb -d logcatt', 'adb -d logcat'), ('adb -e reboott', 'adb -e reboot')]) def test_get_new_command(script, output, new_command): diff --git a/thefuck/rules/adb_unknown_command.py b/thefuck/rules/adb_unknown_command.py index a3fd6d30..44eea6f1 100644 --- a/thefuck/rules/adb_unknown_command.py +++ b/thefuck/rules/adb_unknown_command.py @@ -2,16 +2,29 @@ from thefuck.utils import is_app, get_closest, replace_argument # the most common ADB commands -_ADB_COMMANDS = [ +_ADB_COMMANDS = ( + 'backup', + 'bugreport', + 'connect', 'devices', + 'disconnect', + 'forward', 'install', + 'jdwp', + 'kill-server', 'logcat', 'pull', 'push', 'reboot', + 'reconnect', + 'restore', + 'reverse', + 'run-as', 'shell', + 'start-server', + 'sync', 'uninstall' -] +) def match(command): @@ -21,8 +34,8 @@ def match(command): def get_new_command(command): for idx, arg in enumerate(command.script_parts[1:]): - # allowed params to ADB are d/e/s/p where s and p take additional args + # allowed params to ADB are a/d/e/s/H/P/L where s, H, P and L take additional args # for example 'adb -s 111 logcat' or 'adb -e logcat' - if not arg[0] == '-' and not command.script_parts[idx] in ('-s', '-p'): + if not arg[0] == '-' and not command.script_parts[idx] in ('-s', '-H', '-P', '-L'): adb_cmd = get_closest(arg, _ADB_COMMANDS) return replace_argument(command.script, arg, adb_cmd)