From 4276e1b991ea923a2a3bdd227bb3d98ced1fd4e2 Mon Sep 17 00:00:00 2001 From: SanketDG Date: Fri, 1 May 2015 00:12:30 +0530 Subject: [PATCH 1/3] add alias function --- thefuck/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/thefuck/main.py b/thefuck/main.py index 2ce1dd33..524fe0dd 100644 --- a/thefuck/main.py +++ b/thefuck/main.py @@ -112,6 +112,10 @@ def is_second_run(command): return command.script.startswith('fuck') +def alias(): + print("\nalias fuck='eval $(thefuck $(fc -ln -1))'\n") + + def main(): colorama.init() user_dir = setup_user_dir() From 8a49b40f6a7dea32f72ccf733eca7b6e84c03686 Mon Sep 17 00:00:00 2001 From: SanketDG Date: Fri, 1 May 2015 00:12:43 +0530 Subject: [PATCH 2/3] add entry point --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 28f87e34..90a5852e 100644 --- a/setup.py +++ b/setup.py @@ -17,4 +17,4 @@ setup(name='thefuck', zip_safe=False, install_requires=['pathlib', 'psutil', 'colorama', 'six'], entry_points={'console_scripts': [ - 'thefuck = thefuck.main:main']}) + 'thefuck = thefuck.main:main', 'thefuck-alias = thefuck.main:alias']}) From 32fd929e481ccd4f277df1599e94104667de5931 Mon Sep 17 00:00:00 2001 From: SanketDG Date: Fri, 1 May 2015 00:13:08 +0530 Subject: [PATCH 3/3] add instructions to use thefuck-alias --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 502a6be8..9a13e728 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,12 @@ alias fuck='eval $(thefuck $(fc -ln -1))' alias FUCK='fuck' ``` +Alternatively, you can redirect the output of `thefuck-alias`: + +```bash +thefuck-alias >> ~/.bashrc +``` + [Or in your shell config (Bash, Zsh, Fish, Powershell).](https://github.com/nvbn/thefuck/wiki/Shell-aliases) Changes will be available only in a new shell session. @@ -200,7 +206,7 @@ Or via environment variables: * `THEFUCK_REQUIRE_CONFIRMATION` – require confirmation before running new command, `true/false`; * `THEFUCK_WAIT_COMMAND` – max amount of time in seconds for getting previous command output; * `THEFUCK_NO_COLORS` – disable colored output, `true/false`. - + For example: ```bash