mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-14 06:38:32 +00:00
Add nodenv rule
This commit is contained in:
parent
862abe75cf
commit
629a506116
20
thefuck/rules/nodenv_no_such_command.py
Normal file
20
thefuck/rules/nodenv_no_such_command.py
Normal file
@ -0,0 +1,20 @@
|
||||
import re
|
||||
from subprocess import PIPE, Popen
|
||||
from thefuck.utils import for_app, replace_argument, replace_command
|
||||
from thefuck.specific.devenv import env_available, COMMON_TYPOS, get_commands
|
||||
|
||||
enabled_by_default = env_available
|
||||
|
||||
|
||||
@for_app('nodenv')
|
||||
def match(command):
|
||||
return 'nodenv: no such command' in command.output
|
||||
|
||||
|
||||
@for_app('nodenv')
|
||||
def get_new_command(command):
|
||||
broken = re.findall(r"nodenv: no such command `([^']*)'", command.output)[0]
|
||||
matched = [replace_argument(command.script, broken, common_typo)
|
||||
for common_typo in COMMON_TYPOS.get(broken, [])]
|
||||
matched.extend(replace_command(command, broken, get_commands(command)))
|
||||
return matched
|
Loading…
x
Reference in New Issue
Block a user