mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 17:48:41 +00:00
Re-write get_commands function
This commit is contained in:
parent
a9aa53d71a
commit
f451614fbf
@ -11,9 +11,14 @@ COMMON_TYPOS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_commands(command):
|
def get_commands():
|
||||||
if 'env' in command.script_parts[0]:
|
if which('pyenv'):
|
||||||
proc = Popen([str(command.script_parts[0]), 'commands'], stdout=PIPE)
|
env = 'pyenv'
|
||||||
|
elif which('rbenv'):
|
||||||
|
env = 'rbenv'
|
||||||
|
elif which('goenv'):
|
||||||
|
env = 'goenv'
|
||||||
else:
|
else:
|
||||||
proc = Popen([str(command.script_parts[1]), 'commands'], stdout=PIPE)
|
env = 'nodenv'
|
||||||
|
proc = Popen([env, 'commands'], stdout=PIPE)
|
||||||
return [line.decode('utf-8').strip() for line in proc.stdout.readlines()]
|
return [line.decode('utf-8').strip() for line in proc.stdout.readlines()]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user