1
0
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:
Ryan Callahan 2021-04-12 18:03:32 -04:00
parent 559cd8fa8c
commit 1f680de44c
No known key found for this signature in database
GPG Key ID: 1EA116782D6C6338

18
thefuck/rules/rvm_use.py Normal file
View 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]}'