mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-14 14:48:49 +00:00
Add further ADB commands
This commit is contained in:
parent
207d64a41f
commit
ca72101496
@ -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):
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user