Extend yarn_alias rule to handle package.json scripts
For example, if an "etl" script is defined in package.json, it can be
run with `yarn etl`. However, if `yarn etil` is run, `yarn` will
suggest the correction. This change lets `thefuck` take advantage of
that:
$ yarn etil
yarn etil v0.21.3
error Command "etil" not found. Did you mean "etl"?
$ fuck
yarn etl [enter/?/?/ctrl+c]
This commit is contained in:
@@ -9,6 +9,6 @@ def match(command):
|
||||
|
||||
def get_new_command(command):
|
||||
broken = command.script_parts[1]
|
||||
fix = re.findall(r'Did you mean `yarn ([^`]*)`', command.stderr)[0]
|
||||
fix = re.findall(r'Did you mean [`"](?:yarn )?([^`"]*)[`"]', command.stderr)[0]
|
||||
|
||||
return replace_argument(command.script, broken, fix)
|
||||
|
||||
Reference in New Issue
Block a user