Merge pull request #607 from josephfrazier/yarn-alias

Fix aliased `yarn` commands like `yarn ls`
This commit is contained in:
Vladimir Iakovlev
2017-03-03 13:50:58 +01:00
committed by GitHub
3 changed files with 37 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import re
from thefuck.utils import replace_argument, for_app
@for_app('yarn', at_least=1)
def match(command):
return ('Did you mean' in command.stderr)
def get_new_command(command):
broken = command.script_parts[1]
fix = re.findall(r'Did you mean `yarn ([^`]*)`', command.stderr)[0]
return replace_argument(command.script, broken, fix)