Move commands-related logic to Command and CorrectedCommand

This commit is contained in:
nvbn
2015-09-08 15:00:57 +03:00
parent 4a27595e97
commit a8dbc48fd4
8 changed files with 149 additions and 120 deletions
+1 -1
View File
@@ -27,6 +27,6 @@ def git_support(fn, command):
expansion = ' '.join(map(quote, split(search.group(2))))
new_script = command.script.replace(alias, expansion)
command = Command._replace(command, script=new_script)
command = command.update(script=new_script)
return fn(command)
+1 -3
View File
@@ -9,9 +9,7 @@ def sudo_support(fn, command):
if not command.script.startswith('sudo '):
return fn(command)
result = fn(Command(command.script[5:],
command.stdout,
command.stderr))
result = fn(command.update(script=command.script[5:]))
if result and isinstance(result, six.string_types):
return u'sudo {}'.format(result)