Add yarn_help rule
Yarn likes to keep its documentation online, rather than in `yarn help` output. For example, `yarn help clean` doesn't tell you anything about the `clean` subcommand. Instead, it points you towards https://yarnpkg.com/en/docs/cli/clean This rule detects when that happens, and suggests opening the URL. One caveat is the currently only OSX is supported, as Linux uses `xdg-open` instead of `open`.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import re
|
||||
from thefuck.utils import for_app
|
||||
|
||||
|
||||
@for_app('yarn', at_least=2)
|
||||
def match(command):
|
||||
return command.script_parts[1] == 'help' and ('for documentation about this command.' in command.stdout)
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
fix = re.findall(r'Visit ([^ ]*) for documentation about this command.', command.stdout)[0]
|
||||
|
||||
return 'open ' + fix
|
||||
Reference in New Issue
Block a user