diff --git a/setup.py b/setup.py index 46683c2..7ade426 100755 --- a/setup.py +++ b/setup.py @@ -31,4 +31,4 @@ setup(name='thefuck', extras_require=extras_require, entry_points={'console_scripts': [ 'thefuck = thefuck.main:main', - 'thefuck-alias = thefuck.shells:app_alias']}) + 'thefuck-alias = thefuck.main:print_alias']}) diff --git a/thefuck/main.py b/thefuck/main.py index a573b09..4d92fb2 100644 --- a/thefuck/main.py +++ b/thefuck/main.py @@ -128,6 +128,8 @@ def run_rule(rule, command, settings): print(new_command) +# Entry points: + def main(): colorama.init() user_dir = setup_user_dir() @@ -151,3 +153,10 @@ def main(): return logs.failed('No fuck given', settings) + + +def print_alias(): + alias = shells.thefuck_alias() + if len(sys.argv) > 1: + alias = sys.argv[1] + print(shells.app_alias(alias)) diff --git a/thefuck/shells.py b/thefuck/shells.py index fc8bb1a..7d3164a 100644 --- a/thefuck/shells.py +++ b/thefuck/shells.py @@ -9,7 +9,6 @@ from subprocess import Popen, PIPE from time import time import io import os -import sys from .utils import DEVNULL, memoize @@ -242,11 +241,8 @@ def to_shell(command): return _get_shell().to_shell(command) -def app_alias(): - alias = thefuck_alias() - if len(sys.argv) > 1: - alias = sys.argv[1] - print(_get_shell().app_alias(alias)) +def app_alias(alias): + return _get_shell().app_alias(alias) def thefuck_alias():