mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-20 20:09:07 +00:00
Cleanup the systemctl rule
This commit is contained in:
parent
e3cc9c52e6
commit
330f91f5dc
@ -1,16 +1,21 @@
|
||||
"""
|
||||
The confusion in systemctl's param order is massive
|
||||
The confusion in systemctl's param order is massive.
|
||||
"""
|
||||
from thefuck.utils import sudo_support
|
||||
|
||||
|
||||
@sudo_support
|
||||
def match(command, settings):
|
||||
#Catches 'Unknown operation 'service'.' when executing systemctl with misordered arguments
|
||||
# Catches 'Unknown operation 'service'.' when executing systemctl with
|
||||
# misordered arguments
|
||||
cmd = command.script.split()
|
||||
return ('systemctl' in command.script) and ('Unknown operation \'' in command.stderr) and (len(cmd) - cmd.index('systemctl') == 3);
|
||||
return ('systemctl' in command.script and
|
||||
'Unknown operation \'' in command.stderr and
|
||||
len(cmd) - cmd.index('systemctl') == 3)
|
||||
|
||||
|
||||
@sudo_support
|
||||
def get_new_command(command, settings):
|
||||
cmd = command.script.split()
|
||||
cmd[len(cmd)-1], cmd[len(cmd)-2] = cmd[len(cmd)-2], cmd[len(cmd)-1]
|
||||
cmd[-1], cmd[-2] = cmd[-2], cmd[-1]
|
||||
return ' '.join(cmd)
|
||||
|
Loading…
x
Reference in New Issue
Block a user