mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-20 20:09:07 +00:00
fix(whois): check if there's at least one argument to whois
This avoids thefuck failing when there's no arguments. It fails with: ``` ... File "thefuck/rules/whois.py", line 26, in get_new_command url = command.script.split()[1] IndexError: list index out of range ``` Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
This commit is contained in:
parent
2c3df1ad47
commit
44c06c483e
@ -11,6 +11,10 @@ def test_match(command):
|
||||
assert match(command, None)
|
||||
|
||||
|
||||
def test_not_match():
|
||||
assert not match(Command(script='whois'), None)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command, new_command', [
|
||||
(Command('whois https://en.wikipedia.org/wiki/Main_Page'), 'whois en.wikipedia.org'),
|
||||
(Command('whois https://en.wikipedia.org/'), 'whois en.wikipedia.org'),
|
||||
|
@ -19,7 +19,7 @@ def match(command, settings):
|
||||
- www.google.fr → subdomain: www, domain: 'google.fr';
|
||||
- google.co.uk → subdomain: None, domain; 'google.co.uk'.
|
||||
"""
|
||||
return 'whois' in command.script
|
||||
return 'whois' in command.script and len(command.script.split()) > 1
|
||||
|
||||
|
||||
def get_new_command(command, settings):
|
||||
|
Loading…
x
Reference in New Issue
Block a user