Move get_all_matched_commands over to utils

This commit is contained in:
Pablo Santiago Blum de Aguiar
2015-07-27 22:29:02 -03:00
parent 742200a500
commit 4e854a575e
3 changed files with 43 additions and 12 deletions
+9
View File
@@ -159,3 +159,12 @@ def replace_argument(script, from_, to):
else:
return script.replace(
u' {} '.format(from_), u' {} '.format(to), 1)
def get_all_matched_commands(stderr, separator='Did you mean'):
should_yield = False
for line in stderr.split('\n'):
if separator in line:
should_yield = True
elif should_yield and line:
yield line.strip()