mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 01:28:56 +00:00
added rule for drmemory commands missing --
This commit is contained in:
parent
3bbd0e9463
commit
cbdd7c4cc8
@ -192,6 +192,7 @@ following rules are enabled by default:
|
|||||||
* `docker_login` – executes a `docker login` and repeats the previous command;
|
* `docker_login` – executes a `docker login` and repeats the previous command;
|
||||||
* `docker_not_command` – fixes wrong docker commands like `docker tags`;
|
* `docker_not_command` – fixes wrong docker commands like `docker tags`;
|
||||||
* `docker_image_being_used_by_container` ‐ removes the container that is using the image before removing the image;
|
* `docker_image_being_used_by_container` ‐ removes the container that is using the image before removing the image;
|
||||||
|
* `drmemory_no_dashdash` – adds `--` to drmemory commands;
|
||||||
* `dry` – fixes repetitions like `git git push`;
|
* `dry` – fixes repetitions like `git git push`;
|
||||||
* `fab_command_not_found` – fix misspelled fabric commands;
|
* `fab_command_not_found` – fix misspelled fabric commands;
|
||||||
* `fix_alt_space` – replaces Alt+Space with Space character;
|
* `fix_alt_space` – replaces Alt+Space with Space character;
|
||||||
|
27
tests/rules/test_drmemory_no_app_specified.py
Normal file
27
tests/rules/test_drmemory_no_app_specified.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import pytest
|
||||||
|
from thefuck.rules.drmemory_no_dashdash import match, get_new_command
|
||||||
|
from thefuck.types import Command
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('command', [
|
||||||
|
Command('drmemory a.out', 'Usage: drmemory [options] --'),
|
||||||
|
Command('/etc/bin/drmemory test.exe', 'Usage: drmemory [options] --'),
|
||||||
|
])
|
||||||
|
def test_match(command):
|
||||||
|
assert match(command)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('command', [
|
||||||
|
Command('drmemory -- a.out', ''),
|
||||||
|
Command('/etc/bin/drmemory -- test.exe', ''),
|
||||||
|
])
|
||||||
|
def test_not_match(command):
|
||||||
|
assert not match(command)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('command, new_command', [
|
||||||
|
(Command('drmemory a.out', ''), 'drmemory -- a.out'),
|
||||||
|
(Command('/etc/bin/drmemory test.exe', ''), '/etc/bin/drmemory -- test.exe'),
|
||||||
|
])
|
||||||
|
def test_get_new_command(command, new_command):
|
||||||
|
assert get_new_command(command) == new_command
|
19
thefuck/rules/drmemory_no_dashdash.py
Normal file
19
thefuck/rules/drmemory_no_dashdash.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
from thefuck.specific.sudo import sudo_support
|
||||||
|
|
||||||
|
|
||||||
|
@sudo_support
|
||||||
|
def match(command):
|
||||||
|
return (
|
||||||
|
"drmemory" in command.script
|
||||||
|
and len(command.script.split()) >= 2
|
||||||
|
and "Usage: drmemory [options] --" in command.output
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@sudo_support
|
||||||
|
def get_new_command(command):
|
||||||
|
return(
|
||||||
|
command.script.split()[0]
|
||||||
|
+ " -- "
|
||||||
|
+ " ".join(command.script.split()[1:])
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user