mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-14 06:38:32 +00:00
Add rvm use support
gets the error output from rvm use when run in a subprocess spawned by python. fixes the command by first installing the request ruby version then running rvm use.
This commit is contained in:
parent
559cd8fa8c
commit
1f680de44c
18
thefuck/rules/rvm_use.py
Normal file
18
thefuck/rules/rvm_use.py
Normal file
@ -0,0 +1,18 @@
|
||||
from thefuck.utils import for_app
|
||||
|
||||
|
||||
@for_app('rvm', at_least=2)
|
||||
def match(command):
|
||||
args = command.script_parts
|
||||
pattern = f"""RVM is not a function, selecting rubies with 'rvm use ...' will not work.
|
||||
|
||||
You need to change your terminal emulator preferences to allow login shell.
|
||||
Sometimes it is required to use `/bin/bash --login` as the command.
|
||||
Please visit https://rvm.io/integration/gnome-terminal/ for an example."""
|
||||
|
||||
return args[1] == 'use' and pattern in command.output
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
args = command.script_parts
|
||||
return f'rvm install \"ruby-{args[2]}\"; rvm use {args[2]}'
|
Loading…
x
Reference in New Issue
Block a user