Magnificent app which corrects your previous console command.

Overview

The Fuck Version Build Status Coverage MIT License

The Fuck is a magnificent app, inspired by a @liamosaur tweet, that corrects errors in previous console commands.

Is The Fuck too slow? Try the experimental instant mode!

gif with examples

More examples:

➜ apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

➜ fuck
sudo apt-get install vim [enter/↑/↓/ctrl+c]
[sudo] password for nvbn:
Reading package lists... Done
...
➜ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master


➜ fuck
git push --set-upstream origin master [enter/↑/↓/ctrl+c]
Counting objects: 9, done.
...
➜ puthon
No command 'puthon' found, did you mean:
 Command 'python' from package 'python-minimal' (main)
 Command 'python' from package 'python3' (main)
zsh: command not found: puthon

➜ fuck
python [enter/↑/↓/ctrl+c]
Python 3.4.2 (default, Oct  8 2014, 13:08:17)
...
➜ git brnch
git: 'brnch' is not a git command. See 'git --help'.

Did you mean this?
    branch

➜ fuck
git branch [enter/↑/↓/ctrl+c]
* master
➜ lein rpl
'rpl' is not a task. See 'lein help'.

Did you mean this?
         repl

➜ fuck
lein repl [enter/↑/↓/ctrl+c]
nREPL server started on port 54848 on host 127.0.0.1 - nrepl://127.0.0.1:54848
REPL-y 0.3.1
...

If you're not afraid of blindly running corrected commands, the require_confirmation settings option can be disabled:

➜ apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

➜ fuck
sudo apt-get install vim
[sudo] password for nvbn:
Reading package lists... Done
...

Contents

  1. Requirements
  2. Installations
  3. Updating
  4. How it works
  5. Creating your own rules
  6. Settings
  7. Third party packages with rules
  8. Experimental instant mode
  9. Developing
  10. License

Requirements

  • python (3.4+)
  • pip
  • python-dev
Back to Contents

Installation

On OS X, you can install The Fuck via Homebrew (or via Linuxbrew on Linux):

brew install thefuck

On Ubuntu / Mint, install The Fuck with the following commands:

sudo apt update
sudo apt install python3-dev python3-pip python3-setuptools
sudo pip3 install thefuck

On FreeBSD, install The Fuck with the following commands:

pkg install thefuck

On ChromeOS, install The Fuck using chromebrew with the following command:

crew install thefuck

On other systems, install The Fuck by using pip:

pip install thefuck

Alternatively, you may use an OS package manager (OS X, Ubuntu, Arch).

# It is recommended that you place this command in your .bash_profile, .bashrc, .zshrc or other startup script:

eval $(thefuck --alias)
# You can use whatever you want as an alias, like for Mondays:
eval $(thefuck --alias FUCK)

Or in your shell config (Bash, Zsh, Fish, Powershell, tcsh).

Changes are only available in a new shell session. To make changes immediately available, run source ~/.bashrc (or your shell config file like .zshrc).

To run fixed commands without confirmation, use the --yeah option (or just -y for short, or --hard if you're especially frustrated):

fuck --yeah

To fix commands recursively until succeeding, use the -r option:

fuck -r
Back to Contents

Updating

pip3 install thefuck --upgrade

Note: Alias functionality was changed in v1.34 of The Fuck

How it works

The Fuck attempts to match the previous command with a rule. If a match is found, a new command is created using the matched rule and executed. The following rules are enabled by default:

  • adb_unknown_command – fixes misspelled commands like adb logcta;
  • ag_literal – adds -Q to ag when suggested;
  • aws_cli – fixes misspelled commands like aws dynamdb scan;
  • az_cli – fixes misspelled commands like az providers;
  • cargo – runs cargo build instead of cargo;
  • cargo_no_command – fixes wrongs commands like cargo buid;
  • cat_dir – replaces cat with ls when you try to cat a directory;
  • cd_correction – spellchecks and correct failed cd commands;
  • cd_cs – changes cs to cd;
  • cd_mkdir – creates directories before cd'ing into them;
  • cd_parent – changes cd.. to cd ..;
  • chmod_x – add execution bit;
  • choco_install – append common suffixes for chocolatey packages;
  • composer_not_command – fixes composer command name;
  • conda_mistype – fixes conda commands;
  • cp_create_destination – creates a new directory when you attempt to cp or mv to a non existent one
  • cp_omitting_directory – adds -a when you cp directory;
  • cpp11 – adds missing -std=c++11 to g++ or clang++;
  • dirty_untar – fixes tar x command that untarred in the current directory;
  • dirty_unzip – fixes unzip command that unzipped in the current directory;
  • django_south_ghost – adds --delete-ghost-migrations to failed because ghosts django south migration;
  • django_south_merge – adds --merge to inconsistent django south migration;
  • docker_login – executes a docker login and repeats the previous command;
  • docker_not_command – fixes wrong docker commands like docker tags;
  • docker_image_being_used_by_container ‐ removes the container that is using the image before removing the image;
  • dry – fixes repetitions like git git push;
  • fab_command_not_found – fix misspelled fabric commands;
  • fix_alt_space – replaces Alt+Space with Space character;
  • fix_file – opens a file with an error in your $EDITOR;
  • gem_unknown_command – fixes wrong gem commands;
  • git_add – fixes "pathspec 'foo' did not match any file(s) known to git.";
  • git_add_force – adds --force to git add <pathspec>... when paths are .gitignore'd;
  • git_bisect_usage – fixes git bisect strt, git bisect goood, git bisect rset, etc. when bisecting;
  • git_branch_delete – changes git branch -d to git branch -D;
  • git_branch_delete_checked_out – changes git branch -d to git checkout master && git branch -D when trying to delete a checked out branch;
  • git_branch_exists – offers git branch -d foo, git branch -D foo or git checkout foo when creating a branch that already exists;
  • git_branch_list – catches git branch list in place of git branch and removes created branch;
  • git_checkout – fixes branch name or creates new branch;
  • git_clone_git_clone – replaces git clone git clone ... with git clone ...
  • git_commit_amend – offers git commit --amend after previous commit;
  • git_commit_reset – offers git reset HEAD~ after previous commit;
  • git_diff_no_index – adds --no-index to previous git diff on untracked files;
  • git_diff_staged – adds --staged to previous git diff with unexpected output;
  • git_fix_stash – fixes git stash commands (misspelled subcommand and missing save);
  • git_flag_after_filename – fixes fatal: bad flag '...' after filename
  • git_help_aliased – fixes git help <alias> commands replacing with the aliased command;
  • git_hook_bypass – adds --no-verify flag previous to git am, git commit, or git push command;
  • git_lfs_mistype – fixes mistyped git lfs <command> commands;
  • git_merge – adds remote to branch names;
  • git_merge_unrelated – adds --allow-unrelated-histories when required
  • git_not_command – fixes wrong git commands like git brnch;
  • git_pull – sets upstream before executing previous git pull;
  • git_pull_clone – clones instead of pulling when the repo does not exist;
  • git_pull_uncommitted_changes – stashes changes before pulling and pops them afterwards;
  • git_push – adds --set-upstream origin $branch to previous failed git push;
  • git_push_different_branch_names – fixes pushes when local brach name does not match remote branch name;
  • git_push_pull – runs git pull when push was rejected;
  • git_push_without_commits – Creates an initial commit if you forget and only git add ., when setting up a new project;
  • git_rebase_no_changes – runs git rebase --skip instead of git rebase --continue when there are no changes;
  • git_remote_delete – replaces git remote delete remote_name with git remote remove remote_name;
  • git_rm_local_modifications – adds -f or --cached when you try to rm a locally modified file;
  • git_rm_recursive – adds -r when you try to rm a directory;
  • git_rm_staged – adds -f or --cached when you try to rm a file with staged changes
  • git_rebase_merge_dir – offers git rebase (--continue | --abort | --skip) or removing the .git/rebase-merge dir when a rebase is in progress;
  • git_remote_seturl_add – runs git remote add when git remote set_url on nonexistent remote;
  • git_stash – stashes your local modifications before rebasing or switching branch;
  • git_stash_pop – adds your local modifications before popping stash, then resets;
  • git_tag_force – adds --force to git tag <tagname> when the tag already exists;
  • git_two_dashes – adds a missing dash to commands like git commit -amend or git rebase -continue;
  • go_run – appends .go extension when compiling/running Go programs;
  • go_unknown_command – fixes wrong go commands, for example go bulid;
  • gradle_no_task – fixes not found or ambiguous gradle task;
  • gradle_wrapper – replaces gradle with ./gradlew;
  • grep_arguments_order – fixes grep arguments order for situations like grep -lir . test;
  • grep_recursive – adds -r when you try to grep directory;
  • grunt_task_not_found – fixes misspelled grunt commands;
  • gulp_not_task – fixes misspelled gulp tasks;
  • has_exists_script – prepends ./ when script/binary exists;
  • heroku_multiple_apps – add --app <app> to heroku commands like heroku pg;
  • heroku_not_command – fixes wrong heroku commands like heroku log;
  • history – tries to replace command with most similar command from history;
  • hostscli – tries to fix hostscli usage;
  • ifconfig_device_not_found – fixes wrong device names like wlan0 to wlp2s0;
  • java – removes .java extension when running Java programs;
  • javac – appends missing .java when compiling Java files;
  • lein_not_task – fixes wrong lein tasks like lein rpl;
  • long_form_help – changes -h to --help when the short form version is not supported
  • ln_no_hard_link – catches hard link creation on directories, suggest symbolic link;
  • ln_s_order – fixes ln -s arguments order;
  • ls_all – adds -A to ls when output is empty;
  • ls_lah – adds -lah to ls;
  • man – changes manual section;
  • man_no_space – fixes man commands without spaces, for example mandiff;
  • mercurial – fixes wrong hg commands;
  • missing_space_before_subcommand – fixes command with missing space like npminstall;
  • mkdir_p – adds -p when you try to create a directory without parent;
  • mvn_no_command – adds clean package to mvn;
  • mvn_unknown_lifecycle_phase – fixes misspelled life cycle phases with mvn;
  • npm_missing_script – fixes npm custom script name in npm run-script <script>;
  • npm_run_script – adds missing run-script for custom npm scripts;
  • npm_wrong_command – fixes wrong npm commands like npm urgrade;
  • no_command – fixes wrong console commands, for example vom/vim;
  • no_such_file – creates missing directories with mv and cp commands;
  • omnienv_no_such_command – fixes wrong commands for goenv, nodenv, pyenv and rbenv (eg.: pyenv isntall or goenv list);
  • open – either prepends http:// to address passed to open or create a new file or directory and passes it to open;
  • pip_install – fixes permission issues with pip install commands by adding --user or prepending sudo if necessary;
  • pip_unknown_command – fixes wrong pip commands, for example pip instatl/pip install;
  • php_s – replaces -s by -S when trying to run a local php server;
  • port_already_in_use – kills process that bound port;
  • prove_recursively – adds -r when called with directory;
  • python_command – prepends python when you try to run non-executable/without ./ python script;
  • python_execute – appends missing .py when executing Python files;
  • python_module_error – fixes ModuleNotFoundError by trying to pip install that module;
  • quotation_marks – fixes uneven usage of ' and " when containing args';
  • path_from_history – replaces not found path with similar absolute path from history;
  • react_native_command_unrecognized – fixes unrecognized react-native commands;
  • remove_shell_prompt_literal – remove leading shell prompt symbol $, common when copying commands from documentations;
  • remove_trailing_cedilla – remove trailing cedillas ç, a common typo for european keyboard layouts;
  • rm_dir – adds -rf when you try to remove a directory;
  • scm_correction – corrects wrong scm like hg log to git log;
  • sed_unterminated_s – adds missing '/' to sed's s commands;
  • sl_ls – changes sl to ls;
  • ssh_known_hosts – removes host from known_hosts on warning;
  • sudo – prepends sudo to previous command if it failed because of permissions;
  • sudo_command_from_user_path – runs commands from users $PATH with sudo;
  • switch_lang – switches command from your local layout to en;
  • systemctl – correctly orders parameters of confusing systemctl;
  • terraform_init.py – run terraform init before plan or apply;
  • test.py – runs py.test instead of test.py;
  • touch – creates missing directories before "touching";
  • tsuru_login – runs tsuru login if not authenticated or session expired;
  • tsuru_not_command – fixes wrong tsuru commands like tsuru shell;
  • tmux – fixes tmux commands;
  • unknown_command – fixes hadoop hdfs-style "unknown command", for example adds missing '-' to the command on hdfs dfs ls;
  • unsudo – removes sudo from previous command if a process refuses to run on super user privilege.
  • vagrant_up – starts up the vagrant instance;
  • whois – fixes whois command;
  • workon_doesnt_exists – fixes virtualenvwrapper env name os suggests to create new.
  • yarn_alias – fixes aliased yarn commands like yarn ls;
  • yarn_command_not_found – fixes misspelled yarn commands;
  • yarn_command_replaced – fixes replaced yarn commands;
  • yarn_help – makes it easier to open yarn documentation;
Back to Contents

The following rules are enabled by default on specific platforms only:

  • apt_get – installs app from apt if it not installed (requires python-commandnotfound / python3-commandnotfound);
  • apt_get_search – changes trying to search using apt-get with searching using apt-cache;
  • apt_invalid_operation – fixes invalid apt and apt-get calls, like apt-get isntall vim;
  • apt_list_upgradable – helps you run apt list --upgradable after apt update;
  • apt_upgrade – helps you run apt upgrade after apt list --upgradable;
  • brew_cask_dependency – installs cask dependencies;
  • brew_install – fixes formula name for brew install;
  • brew_reinstall – turns brew install <formula> into brew reinstall <formula>;
  • brew_link – adds --overwrite --dry-run if linking fails;
  • brew_uninstall – adds --force to brew uninstall if multiple versions were installed;
  • brew_unknown_command – fixes wrong brew commands, for example brew docto/brew doctor;
  • brew_update_formula – turns brew update <formula> into brew upgrade <formula>;
  • dnf_no_such_command – fixes mistyped DNF commands;
  • nixos_cmd_not_found – installs apps on NixOS;
  • pacman – installs app with pacman if it is not installed (uses yay or yaourt if available);
  • pacman_invalid_option – replaces lowercase pacman options with uppercase.
  • pacman_not_found – fixes package name with pacman, yay or yaourt.
  • yum_invalid_operation – fixes invalid yum calls, like yum isntall vim;

The following commands are bundled with The Fuck, but are not enabled by default:

  • git_push_force – adds --force-with-lease to a git push (may conflict with git_push_pull);
  • rm_root – adds --no-preserve-root to rm -rf / command.
Back to Contents

Creating your own rules

To add your own rule, create a file named your-rule-name.py in ~/.config/thefuck/rules. The rule file must contain two functions:

match(command: Command) -> bool
get_new_command(command: Command) -> str | list[str]

Additionally, rules can contain optional functions:

side_effect(old_command: Command, fixed_command: str) -> None

Rules can also contain the optional variables enabled_by_default, requires_output and priority.

Command has three attributes: script, output and script_parts. Your rule should not change Command.

Rules api changed in 3.0: To access a rule's settings, import it with from thefuck.conf import settings

settings is a special object assembled from ~/.config/thefuck/settings.py, and values from env (see more below).

A simple example rule for running a script with sudo:

def match(command):
    return ('permission denied' in command.output.lower()
            or 'EACCES' in command.output)


def get_new_command(command):
    return 'sudo {}'.format(command.script)

# Optional:
enabled_by_default = True

def side_effect(command, fixed_command):
    subprocess.call('chmod 777 .', shell=True)

priority = 1000  # Lower first, default is 1000

requires_output = True

More examples of rules, utility functions for rules, app/os-specific helpers.

Back to Contents

Settings

Several The Fuck parameters can be changed in the file $XDG_CONFIG_HOME/thefuck/settings.py ($XDG_CONFIG_HOME defaults to ~/.config):

  • rules – list of enabled rules, by default thefuck.const.DEFAULT_RULES;
  • exclude_rules – list of disabled rules, by default [];
  • require_confirmation – requires confirmation before running new command, by default True;
  • wait_command – max amount of time in seconds for getting previous command output;
  • no_colors – disable colored output;
  • priority – dict with rules priorities, rule with lower priority will be matched first;
  • debug – enables debug output, by default False;
  • history_limit – numeric value of how many history commands will be scanned, like 2000;
  • alter_history – push fixed command to history, by default True;
  • wait_slow_command – max amount of time in seconds for getting previous command output if it in slow_commands list;
  • slow_commands – list of slow commands;
  • num_close_matches – maximum number of close matches to suggest, by default 3.
  • excluded_search_path_prefixes – path prefixes to ignore when searching for commands, by default [].

An example of settings.py:

rules = ['sudo', 'no_command']
exclude_rules = ['git_push']
require_confirmation = True
wait_command = 10
no_colors = False
priority = {'sudo': 100, 'no_command': 9999}
debug = False
history_limit = 9999
wait_slow_command = 20
slow_commands = ['react-native', 'gradle']
num_close_matches = 5

Or via environment variables:

  • THEFUCK_RULES – list of enabled rules, like DEFAULT_RULES:rm_root or sudo:no_command;
  • THEFUCK_EXCLUDE_RULES – list of disabled rules, like git_pull:git_push;
  • 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;
  • THEFUCK_PRIORITY – priority of the rules, like no_command=9999:apt_get=100, rule with lower priority will be matched first;
  • THEFUCK_DEBUG – enables debug output, true/false;
  • THEFUCK_HISTORY_LIMIT – how many history commands will be scanned, like 2000;
  • THEFUCK_ALTER_HISTORY – push fixed command to history true/false;
  • THEFUCK_WAIT_SLOW_COMMAND – max amount of time in seconds for getting previous command output if it in slow_commands list;
  • THEFUCK_SLOW_COMMANDS – list of slow commands, like lein:gradle;
  • THEFUCK_NUM_CLOSE_MATCHES – maximum number of close matches to suggest, like 5.
  • THEFUCK_EXCLUDED_SEARCH_PATH_PREFIXES – path prefixes to ignore when searching for commands, by default [].

For example:

export THEFUCK_RULES='sudo:no_command'
export THEFUCK_EXCLUDE_RULES='git_pull:git_push'
export THEFUCK_REQUIRE_CONFIRMATION='true'
export THEFUCK_WAIT_COMMAND=10
export THEFUCK_NO_COLORS='false'
export THEFUCK_PRIORITY='no_command=9999:apt_get=100'
export THEFUCK_HISTORY_LIMIT='2000'
export THEFUCK_NUM_CLOSE_MATCHES='5'
Back to Contents

Third-party packages with rules

If you'd like to make a specific set of non-public rules, but would still like to share them with others, create a package named thefuck_contrib_* with the following structure:

thefuck_contrib_foo
  thefuck_contrib_foo
    rules
      __init__.py
      *third-party rules*
    __init__.py
    *third-party-utils*
  setup.py

The Fuck will find rules located in the rules module.

Back to Contents

Experimental instant mode

The default behavior of The Fuck requires time to re-run previous commands. When in instant mode, The Fuck saves time by logging output with script, then reading the log.

gif with instant mode

Currently, instant mode only supports Python 3 with bash or zsh. zsh's autocorrect function also needs to be disabled in order for thefuck to work properly.

To enable instant mode, add --enable-experimental-instant-mode to the alias initialization in .bashrc, .bash_profile or .zshrc.

For example:

eval $(thefuck --alias --enable-experimental-instant-mode)
Back to Contents

Developing

See CONTRIBUTING.md

License MIT

Project License can be found here.

Back to Contents
Issues
  • Getting `nologin git push` when pushing to a git branch without upstream

    Getting `nologin git push` when pushing to a git branch without upstream

    The output of thefuck --version (something like `The Fuck 3.1 using Python

    3.5.0 and Bash 4.4.12(1)-release`):

    The Fuck 3.32 using Python 3.9.4 and ZSH 5.8
    

    Your system (Debian 7, ArchLinux, Windows, etc.):

    macOS Monterey version 12.0.1
    

    How to reproduce the bug:

    This might also be related to my git configuration, so mostly posting to see if someone else has this issue and how they fixed it. If this happened to any git user it would definitely have an easy to find solution. To reproduce, create a branch in any git project, add a commit, push the branch to origin. You'll get a message like this:

    fatal: The current branch foobranch has no upstream branch.
    To push the current branch and set the remote as upstream, use
    
        git push --set-upstream origin foobranch
    

    Use the command fuck, I get the following message:

    nologin git push [enter/↑/↓/ctrl+c]
    

    Hitting enter results in the message "This account is currently not available."

    The output of The Fuck with THEFUCK_DEBUG=true exported (typically execute export THEFUCK_DEBUG=true in your shell before The Fuck):

    same output
    

    If the bug only appears with a specific application, the output of that application and its version:

    git --version: git version 2.24.3 (Apple Git-128)
    

    Anything else you think is relevant:

    Happy to answer any question to help find what's going on.

    opened by dgrcode 1
  • add base for tar rule

    add base for tar rule

    opened by yaacornus 0
  • Causes shell crash on first loads

    Causes shell crash on first loads

    The output of thefuck --version (something like The Fuck 3.1 using Python 3.5.0 and Bash 4.4.12(1)-release):

    ❯ thefuck --version
    The Fuck 3.32 using Python 3.10.1 and ZSH 5.8
    

    Your system (Debian 7, ArchLinux, Windows, etc.):

    macOS Monterey 12.1
    

    How to reproduce the bug:

    Open a new terminal session
    

    The output of The Fuck with THEFUCK_DEBUG=true exported (typically execute export THEFUCK_DEBUG=true in your shell before The Fuck):

    ❯ thefuck
    usage: thefuck [-v] [-a [ALIAS]] [-l SHELL_LOGGER] [--enable-experimental-instant-mode] [-h] [-y | -r] [-d] [command ...]
    

    If the bug only appears with a specific application, the output of that application and its version:

    This only appears the first time I open a new tab in iTerm. With iTerm set to auto close tabs when the session ends, it opens, and then automatically closes after a couple of seconds. I can open a new tab again and then it is fine. However, if I open another tab, it fails again in the same way. When I turn off auto close, I get this output that is crashing my shell the first time each tab is opened:

    Last login: Thu Jan 13 12:57:40 on ttys010
    Traceback (most recent call last):
      File "/usr/local/bin/thefuck", line 13, in <module>
        sys.exit(main())
      File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/entrypoints/main.py", line 38, in main
        shell_logger(known_args.shell_logger)
      File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/entrypoints/shell_logger.py", line 77, in shell_logger
        return_code = _spawn(os.environ['SHELL'], partial(_read, buffer))
      File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/entrypoints/shell_logger.py", line 51, in _spawn
        _set_pty_size(master_fd)
      File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/entrypoints/shell_logger.py", line 29, in _set_pty_size
        fcntl.ioctl(pty.STDOUT_FILENO, termios.TIOCGWINSZ, buf, True)
    OSError: [Errno 25] Inappropriate ioctl for device
    

    Anything else you think is relevant:

    I see that this sounds similar to #1112, however, the errors are different as this seems to be a Python error, not a permission denied error on /proc. I can open a new tab twice for now as a workaround but would like to know how the first time a tab is opened this fails and then works (working meaning the shell, plus thefuck command itself which seems to work fine once the shell is successfully opened). Happy to provide whatever info or logging is needed to resolve this issue. Thanks!

    opened by bduff9 3
  • add sudo error message of Fedora in patterns

    add sudo error message of Fedora in patterns

    dnf remove or dnf install that was not executed with sudo or without superuser previleges has different error message compared to the patterns given, hence was not usually recognized. I added the error messages given by Fedora in the patters.

    opened by yaacornus 0
  • Migrate mock to unittest.mock

    Migrate mock to unittest.mock

    Hi, I'm updating thefuck for Fedora an stumbled across this issue. The mock package is deprecated in Fedora and we're trying to remove it.

    Mock has been included in the standard library since python 3.3. Would you been open to migrate it to unittest.mock?

    opened by principis 2
  • Fails to recognise DNF's plea for root.

    Fails to recognise DNF's plea for root.

    The output of thefuck --version (something like The Fuck 3.1 using Python 3.5.0 and Bash 4.4.12(1)-release):

    The Fuck 3.32 using Python 3.10.1 and Fish Shell 3.3.1

    Your system (Debian 7, ArchLinux, Windows, etc.):

    Fedora 35

    How to reproduce the bug:

    Try to use dnf without sudo and then use thefuck.

    The output of The Fuck with THEFUCK_DEBUG=true exported (typically execute export THEFUCK_DEBUG=true in your shell before The Fuck):

    thefuck_out.txt

    If the bug only appears with a specific application, the output of that application and its version:

    It only occurs with DNF.

    Anything else you think is relevant:

    image

    enhancement help wanted contributor-friendly 
    opened by ryleu 4
  • README: add Fedora to list of supported distros

    README: add Fedora to list of supported distros

    Fedora has thefuck in its distro packages.

    opened by rocketraman 0
  • Needs rules for TAR

    Needs rules for TAR

    tar -xsdrffwefwfawefasfd

    (Tar is broken, because remembering tar commands is hard)

    fuck

    *archive magically works.

    (Assuming input file, or argument is a file, we likely want to extract it.) (Assuming input is a folder, we likely want to tar/compress it)

    enhancement help wanted new rule 
    opened by XtremeOwnageDotCom 0
  • fix: fish history file location

    fix: fish history file location

    Fixes #1027

    However, the entries still contain both, the original fuck command and the corrected one. Not sure if this is intended behavior or not. I kept it the way it was.

    On that note, it might be good to update @cache entries to follow xdg as well.

    opened by mainrs 0
  • Different rule found when using fish vs bash/zsh

    Different rule found when using fish vs bash/zsh

    The output of thefuck --version (something like The Fuck 3.1 using Python 3.5.0 and Bash 4.4.12(1)-release):

    The Fuck 3.31 using Python 3.10.1 and Fish Shell 3.3.1
    

    Your system (Debian 7, ArchLinux, Windows, etc.):

    Fedora Linux 35 (Workstation Edition)
    

    How to reproduce the bug

    1. Create a git branch which diverges from upstream such that it would require a force push e.g. using git commit --amend and changing the commit message.
    2. Run a normal push without --force.
    3. Run fuck.

    The output of The Fuck with THEFUCK_DEBUG=true exported (typically execute export THEFUCK_DEBUG=true in your shell before The Fuck):

    Log
    fuck
    DEBUG: Run with settings: {'alter_history': True,
     'debug': True,
     'env': {'GIT_TRACE': '1', 'LANG': 'C', 'LC_ALL': 'C'},
     'exclude_rules': [],
     'excluded_search_path_prefixes': [],
     'history_limit': None,
     'instant_mode': False,
     'no_colors': False,
     'num_close_matches': 3,
     'priority': {},
     'repeat': False,
     'require_confirmation': True,
     'rules': [<const: All rules enabled>],
     'slow_commands': ['lein', 'react-native', 'gradle', './gradlew', 'vagrant'],
     'user_dir': PosixPath('/home/septatrix/.config/thefuck'),
     'wait_command': 3,
     'wait_slow_command': 15}
    DEBUG: Received output: 18:21:50.638803 git.c:455               trace: built-in: git push
    18:21:50.641447 run-command.c:666       trace: run_command: unset GIT_PREFIX; ssh -p 20009 [email protected] 'git-receive-pack '\''/cdedb/cdedb2.git'\'''
    18:21:51.551401 run-command.c:666       trace: run_command: .git/hooks/pre-push origin ssh://[email protected]:20009/cdedb/cdedb2.git
    To ssh://tracker.cde-ev.de:20009/cdedb/cdedb2.git
     ! [rejected]            feature/configurable-db-host -> feature/configurable-db-host (non-fast-forward)
    error: failed to push some refs to 'ssh://tracker.cde-ev.de:20009/cdedb/cdedb2.git'
    hint: Updates were rejected because the tip of your current branch is behind
    hint: its remote counterpart. Integrate the remote changes (e.g.
    hint: 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    
    DEBUG: Call: git push; with env: {'LC_MEASUREMENT': 'en_GB.UTF-8', 'COLORTERM': 'truecolor', 'GNOME_TERMINAL_SCREEN': '/org/gnome/Terminal/screen/20f05158_bd07_42d0_b162_7281d135ce0d', 'LC_MONETARY': 'en_GB.UTF-8', 'XDG_SESSION_CLASS': 'user', 'LANG': 'C', 'VIRTUAL_ENV': '/home/septatrix/Documents/cde/db/cdedb2/.venv', 'VSCODE_GIT_IPC_HANDLE': '/run/user/1000/vscode-git-996b716d83.sock', 'VSCODE_GIT_ASKPASS_MAIN': '/usr/share/code/resources/app/extensions/git/dist/askpass-main.js', 'WAYLAND_DISPLAY': 'wayland-0', 'TERM': 'xterm-256color', '_OLD_VIRTUAL_PATH': '/home/septatrix/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin', 'SHLVL': '3', 'GNOME_TERMINAL_SERVICE': ':1.441', 'TERM_PROGRAM_VERSION': '1.63.2', 'XDG_RUNTIME_DIR': '/run/user/1000', 'VSCODE_GIT_ASKPASS_NODE': '/usr/share/code/code', 'LC_PAPER': 'en_GB.UTF-8', 'PATH': '/home/septatrix/Documents/cde/db/cdedb2/.venv/bin:/home/septatrix/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin', 'USER': 'septatrix', 'XDG_MENU_PREFIX': 'gnome-', 'XDG_CURRENT_DESKTOP': 'GNOME', 'XDG_SESSION_DESKTOP': 'gnome', 'VIRTUAL_ENV_PROMPT': '(.venv) ', 'CHROME_DESKTOP': 'code-url-handler.desktop', '_OLD_FISH_PROMPT_OVERRIDE': '/home/septatrix/Documents/cde/db/cdedb2/.venv', 'PWD': '/home/septatrix/Documents/cde/db/cdedb2', 'DESKTOP_SESSION': 'gnome', 'XMODIFIERS': '@im=ibus', 'SSH_AUTH_SOCK': '/run/user/1000/keyring/ssh', 'SHELL': '/usr/bin/fish', 'XDG_SESSION_TYPE': 'wayland', 'XDG_DATA_DIRS': '/home/septatrix/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/', 'HOME': '/home/septatrix', 'VTE_VERSION': '6602', 'SESSION_MANAGER': 'local/unix:@/tmp/.ICE-unix/1443610,unix/unix:/tmp/.ICE-unix/1443610', 'VSCODE_GIT_ASKPASS_EXTRA_ARGS': '--ms-enable-electron-run-as-node', 'LC_NUMERIC': 'en_GB.UTF-8', 'GDK_BACKEND': 'x11', 'SYSTEMD_EXEC_PID': '1443968', 'NO_AT_BRIDGE': '1', 'BREAKPAD_DUMP_LOCATION': '/home/septatrix/.config/Code/exthost Crash Reports', 'LC_TIME': 'en_GB.UTF-8', 'DISPLAY': ':0', 'THEFUCK_DEBUG': 'true', 'USERNAME': 'septatrix', 'APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL': 'true', 'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/run/user/1000/bus', 'GNOME_SETUP_DISPLAY': ':1', 'TERM_PROGRAM': 'vscode', 'QT_IM_MODULE': 'ibus', 'GDMSESSION': 'gnome', 'ORIGINAL_XDG_CURRENT_DESKTOP': 'GNOME', 'EDITOR': '/usr/bin/nano', 'LOGNAME': 'septatrix', 'GIT_ASKPASS': '/usr/share/code/resources/app/extensions/git/dist/askpass.sh', 'GDM_LANG': 'en_US.UTF-8', 'XAUTHORITY': '/run/user/1000/.mutter-Xwaylandauth.2WCHF1', 'TF_SHELL': 'fish', 'TF_ALIAS': 'fuck', 'PYTHONIOENCODING': 'utf-8', 'LC_ALL': 'C', 'GIT_TRACE': '1'}; is slow: False took: 0:00:00.980850
    DEBUG: Importing rule: adb_unknown_command; took: 0:00:00.000164
    DEBUG: Importing rule: ag_literal; took: 0:00:00.000307
    DEBUG: Importing rule: apt_get; took: 0:00:00.001086
    DEBUG: Importing rule: apt_get_search; took: 0:00:00.000286
    DEBUG: Importing rule: apt_invalid_operation; took: 0:00:00.000436
    DEBUG: Importing rule: apt_list_upgradable; took: 0:00:00.000262
    DEBUG: Importing rule: apt_upgrade; took: 0:00:00.000218
    DEBUG: Importing rule: aws_cli; took: 0:00:00.000225
    DEBUG: Importing rule: az_cli; took: 0:00:00.000186
    DEBUG: Importing rule: brew_cask_dependency; took: 0:00:00.000464
    DEBUG: Importing rule: brew_install; took: 0:00:00.000121
    DEBUG: Importing rule: brew_link; took: 0:00:00.000183
    DEBUG: Importing rule: brew_reinstall; took: 0:00:00.000536
    DEBUG: Importing rule: brew_uninstall; took: 0:00:00.000240
    DEBUG: Importing rule: brew_unknown_command; took: 0:00:00.000141
    DEBUG: Importing rule: brew_update_formula; took: 0:00:00.000201
    DEBUG: Importing rule: brew_upgrade; took: 0:00:00.000108
    DEBUG: Importing rule: cargo; took: 0:00:00.000172
    DEBUG: Importing rule: cargo_no_command; took: 0:00:00.000192
    DEBUG: Importing rule: cat_dir; took: 0:00:00.000173
    DEBUG: Importing rule: cd_correction; took: 0:00:00.000704
    DEBUG: Importing rule: cd_cs; took: 0:00:00.000108
    DEBUG: Importing rule: cd_mkdir; took: 0:00:00.000209
    DEBUG: Importing rule: cd_parent; took: 0:00:00.000116
    DEBUG: Importing rule: chmod_x; took: 0:00:00.000129
    DEBUG: Importing rule: choco_install; took: 0:00:00.000350
    DEBUG: Importing rule: composer_not_command; took: 0:00:00.000238
    DEBUG: Importing rule: conda_mistype; took: 0:00:00.000231
    DEBUG: Importing rule: cp_create_destination; took: 0:00:00.000223
    DEBUG: Importing rule: cp_omitting_directory; took: 0:00:00.000257
    DEBUG: Importing rule: cpp11; took: 0:00:00.000220
    DEBUG: Importing rule: dirty_untar; took: 0:00:00.001978
    DEBUG: Importing rule: dirty_unzip; took: 0:00:00.001140
    DEBUG: Importing rule: django_south_ghost; took: 0:00:00.000128
    DEBUG: Importing rule: django_south_merge; took: 0:00:00.000147
    DEBUG: Importing rule: dnf_no_such_command; took: 0:00:00.000691
    DEBUG: Importing rule: docker_image_being_used_by_container; took: 0:00:00.000248
    DEBUG: Importing rule: docker_login; took: 0:00:00.000196
    DEBUG: Importing rule: docker_not_command; took: 0:00:00.000539
    DEBUG: Importing rule: dry; took: 0:00:00.000161
    DEBUG: Importing rule: fab_command_not_found; took: 0:00:00.000241
    DEBUG: Importing rule: fix_alt_space; took: 0:00:00.000182
    DEBUG: Importing rule: fix_file; took: 0:00:00.001661
    DEBUG: Importing rule: gem_unknown_command; took: 0:00:00.000345
    DEBUG: Importing rule: git_add; took: 0:00:00.000391
    DEBUG: Importing rule: git_add_force; took: 0:00:00.000164
    DEBUG: Importing rule: git_bisect_usage; took: 0:00:00.000192
    DEBUG: Importing rule: git_branch_delete; took: 0:00:00.000183
    DEBUG: Importing rule: git_branch_delete_checked_out; took: 0:00:00.000186
    DEBUG: Importing rule: git_branch_exists; took: 0:00:00.000199
    DEBUG: Importing rule: git_branch_list; took: 0:00:00.000273
    DEBUG: Importing rule: git_checkout; took: 0:00:00.000205
    DEBUG: Importing rule: git_clone_git_clone; took: 0:00:00.000179
    DEBUG: Importing rule: git_commit_amend; took: 0:00:00.000175
    DEBUG: Importing rule: git_commit_reset; took: 0:00:00.000192
    DEBUG: Importing rule: git_diff_no_index; took: 0:00:00.000183
    DEBUG: Importing rule: git_diff_staged; took: 0:00:00.000189
    DEBUG: Importing rule: git_fix_stash; took: 0:00:00.000188
    DEBUG: Importing rule: git_flag_after_filename; took: 0:00:00.000200
    DEBUG: Importing rule: git_help_aliased; took: 0:00:00.000178
    DEBUG: Importing rule: git_hook_bypass; took: 0:00:00.000197
    DEBUG: Importing rule: git_lfs_mistype; took: 0:00:00.000184
    DEBUG: Importing rule: git_merge; took: 0:00:00.000184
    DEBUG: Importing rule: git_merge_unrelated; took: 0:00:00.000173
    DEBUG: Importing rule: git_not_command; took: 0:00:00.000192
    DEBUG: Importing rule: git_pull; took: 0:00:00.000174
    DEBUG: Importing rule: git_pull_clone; took: 0:00:00.000269
    DEBUG: Importing rule: git_pull_uncommitted_changes; took: 0:00:00.000195
    DEBUG: Importing rule: git_push; took: 0:00:00.000176
    DEBUG: Importing rule: git_push_different_branch_names; took: 0:00:00.000184
    DEBUG: Importing rule: git_push_force; took: 0:00:00.000170
    DEBUG: Importing rule: git_push_pull; took: 0:00:00.000226
    DEBUG: Importing rule: git_push_without_commits; took: 0:00:00.000305
    DEBUG: Importing rule: git_rebase_merge_dir; took: 0:00:00.000184
    DEBUG: Importing rule: git_rebase_no_changes; took: 0:00:00.000129
    DEBUG: Importing rule: git_remote_delete; took: 0:00:00.000197
    DEBUG: Importing rule: git_remote_seturl_add; took: 0:00:00.000154
    DEBUG: Importing rule: git_rm_local_modifications; took: 0:00:00.000198
    DEBUG: Importing rule: git_rm_recursive; took: 0:00:00.000190
    DEBUG: Importing rule: git_rm_staged; took: 0:00:00.000171
    DEBUG: Importing rule: git_stash; took: 0:00:00.000192
    DEBUG: Importing rule: git_stash_pop; took: 0:00:00.000169
    DEBUG: Importing rule: git_tag_force; took: 0:00:00.000230
    DEBUG: Importing rule: git_two_dashes; took: 0:00:00.000171
    DEBUG: Importing rule: go_run; took: 0:00:00.000197
    DEBUG: Importing rule: go_unknown_command; took: 0:00:00.000307
    DEBUG: Importing rule: gradle_no_task; took: 0:00:00.000401
    DEBUG: Importing rule: gradle_wrapper; took: 0:00:00.000188
    DEBUG: Importing rule: grep_arguments_order; took: 0:00:00.000159
    DEBUG: Importing rule: grep_recursive; took: 0:00:00.000230
    DEBUG: Importing rule: grunt_task_not_found; took: 0:00:00.000456
    DEBUG: Importing rule: gulp_not_task; took: 0:00:00.000229
    DEBUG: Importing rule: has_exists_script; took: 0:00:00.000176
    DEBUG: Importing rule: heroku_multiple_apps; took: 0:00:00.000191
    DEBUG: Importing rule: heroku_not_command; took: 0:00:00.000207
    DEBUG: Importing rule: history; took: 0:00:00.000110
    DEBUG: Importing rule: hostscli; took: 0:00:00.000201
    DEBUG: Importing rule: ifconfig_device_not_found; took: 0:00:00.000282
    DEBUG: Importing rule: java; took: 0:00:00.000222
    DEBUG: Importing rule: javac; took: 0:00:00.000178
    DEBUG: Importing rule: lein_not_task; took: 0:00:00.000215
    DEBUG: Importing rule: ln_no_hard_link; took: 0:00:00.000196
    DEBUG: Importing rule: ln_s_order; took: 0:00:00.000208
    DEBUG: Importing rule: long_form_help; took: 0:00:00.000142
    DEBUG: Importing rule: ls_all; took: 0:00:00.000202
    DEBUG: Importing rule: ls_lah; took: 0:00:00.000194
    DEBUG: Importing rule: man; took: 0:00:00.000192
    DEBUG: Importing rule: man_no_space; took: 0:00:00.000151
    DEBUG: Importing rule: mercurial; took: 0:00:00.000245
    DEBUG: Importing rule: missing_space_before_subcommand; took: 0:00:00.000171
    DEBUG: Importing rule: mkdir_p; took: 0:00:00.000206
    DEBUG: Importing rule: mvn_no_command; took: 0:00:00.000215
    DEBUG: Importing rule: mvn_unknown_lifecycle_phase; took: 0:00:00.000209
    DEBUG: Importing rule: nixos_cmd_not_found; took: 0:00:00.000470
    DEBUG: Importing rule: no_command; took: 0:00:00.000276
    DEBUG: Importing rule: no_such_file; took: 0:00:00.000137
    DEBUG: Importing rule: npm_missing_script; took: 0:00:00.000431
    DEBUG: Importing rule: npm_run_script; took: 0:00:00.000193
    DEBUG: Importing rule: npm_wrong_command; took: 0:00:00.000255
    DEBUG: Importing rule: omnienv_no_such_command; took: 0:00:00.000407
    DEBUG: Importing rule: open; took: 0:00:00.000264
    DEBUG: Importing rule: pacman; took: 0:00:00.000620
    DEBUG: Importing rule: pacman_invalid_option; took: 0:00:00.000384
    DEBUG: Importing rule: pacman_not_found; took: 0:00:00.000178
    DEBUG: Importing rule: path_from_history; took: 0:00:00.000202
    DEBUG: Importing rule: php_s; took: 0:00:00.000252
    DEBUG: Importing rule: pip_install; took: 0:00:00.000255
    DEBUG: Importing rule: pip_unknown_command; took: 0:00:00.000276
    DEBUG: Importing rule: port_already_in_use; took: 0:00:00.000324
    DEBUG: Importing rule: prove_recursively; took: 0:00:00.000276
    DEBUG: Importing rule: pyenv_no_such_command; took: 0:00:00.000443
    DEBUG: Importing rule: python_command; took: 0:00:00.000235
    DEBUG: Importing rule: python_execute; took: 0:00:00.000231
    DEBUG: Importing rule: python_module_error; took: 0:00:00.000162
    DEBUG: Importing rule: quotation_marks; took: 0:00:00.000151
    DEBUG: Importing rule: react_native_command_unrecognized; took: 0:00:00.000498
    DEBUG: Importing rule: remove_shell_prompt_literal; took: 0:00:00.000378
    DEBUG: Importing rule: remove_trailing_cedilla; took: 0:00:00.000319
    DEBUG: Importing rule: rm_dir; took: 0:00:00.000452
    DEBUG: Importing rule: rm_root; took: 0:00:00.000350
    DEBUG: Importing rule: scm_correction; took: 0:00:00.000286
    DEBUG: Importing rule: sed_unterminated_s; took: 0:00:00.000251
    DEBUG: Importing rule: sl_ls; took: 0:00:00.000145
    DEBUG: Importing rule: ssh_known_hosts; took: 0:00:00.000245
    DEBUG: Importing rule: sudo; took: 0:00:00.000156
    DEBUG: Importing rule: sudo_command_from_user_path; took: 0:00:00.000261
    DEBUG: Importing rule: switch_lang; took: 0:00:00.000273
    DEBUG: Importing rule: systemctl; took: 0:00:00.000374
    DEBUG: Importing rule: terraform_init; took: 0:00:00.000419
    DEBUG: Importing rule: test.py; took: 0:00:00.000190
    DEBUG: Importing rule: tmux; took: 0:00:00.000276
    DEBUG: Importing rule: touch; took: 0:00:00.000322
    DEBUG: Importing rule: tsuru_login; took: 0:00:00.000318
    DEBUG: Importing rule: tsuru_not_command; took: 0:00:00.000328
    DEBUG: Importing rule: unknown_command; took: 0:00:00.000170
    DEBUG: Importing rule: unsudo; took: 0:00:00.000139
    DEBUG: Importing rule: vagrant_up; took: 0:00:00.000288
    DEBUG: Importing rule: whois; took: 0:00:00.000516
    DEBUG: Importing rule: workon_doesnt_exists; took: 0:00:00.000317
    DEBUG: Importing rule: yarn_alias; took: 0:00:00.000295
    DEBUG: Importing rule: yarn_command_not_found; took: 0:00:00.000631
    DEBUG: Importing rule: yarn_command_replaced; took: 0:00:00.000538
    DEBUG: Importing rule: yarn_help; took: 0:00:00.000327
    DEBUG: Importing rule: yum_invalid_operation; took: 0:00:00.000718
    DEBUG: Trying rule: path_from_history; took: 0:00:00.000624
    DEBUG: Trying rule: cd_cs; took: 0:00:00.000077
    DEBUG: Trying rule: dry; took: 0:00:00.000004
    DEBUG: Trying rule: git_hook_bypass; took: 0:00:00.000079
    DEBUG: Trying rule: git_stash_pop; took: 0:00:00.000041
    DEBUG: Trying rule: test.py; took: 0:00:00.000003
    DEBUG: Trying rule: adb_unknown_command; took: 0:00:00.000019
    DEBUG: Trying rule: ag_literal; took: 0:00:00.000041
    DEBUG: Trying rule: aws_cli; took: 0:00:00.000031
    DEBUG: Trying rule: az_cli; took: 0:00:00.000034
    DEBUG: Trying rule: brew_link; took: 0:00:00.000056
    DEBUG: Trying rule: brew_reinstall; took: 0:00:00.000032
    DEBUG: Trying rule: brew_uninstall; took: 0:00:00.000028
    DEBUG: Trying rule: brew_update_formula; took: 0:00:00.000033
    DEBUG: Trying rule: cargo; took: 0:00:00.000003
    DEBUG: Trying rule: cargo_no_command; took: 0:00:00.000032
    DEBUG: Trying rule: cat_dir; took: 0:00:00.000035
    DEBUG: Trying rule: cd_correction; took: 0:00:00.000049
    DEBUG: Trying rule: cd_mkdir; took: 0:00:00.000048
    DEBUG: Trying rule: cd_parent; took: 0:00:00.000002
    DEBUG: Trying rule: chmod_x; took: 0:00:00.000003
    DEBUG: Trying rule: composer_not_command; took: 0:00:00.000030
    DEBUG: Trying rule: conda_mistype; took: 0:00:00.000029
    DEBUG: Trying rule: cp_create_destination; took: 0:00:00.000023
    DEBUG: Trying rule: cp_omitting_directory; took: 0:00:00.000034
    DEBUG: Trying rule: cpp11; took: 0:00:00.000031
    DEBUG: Trying rule: dirty_untar; took: 0:00:00.000026
    DEBUG: Trying rule: dirty_unzip; took: 0:00:00.000028
    DEBUG: Trying rule: django_south_ghost; took: 0:00:00.000003
    DEBUG: Trying rule: django_south_merge; took: 0:00:00.000003
    DEBUG: Trying rule: dnf_no_such_command; took: 0:00:00.000054
    DEBUG: Trying rule: docker_image_being_used_by_container; took: 0:00:00.000032
    DEBUG: Trying rule: docker_login; took: 0:00:00.000026
    DEBUG: Trying rule: docker_not_command; took: 0:00:00.000034
    DEBUG: Trying rule: fab_command_not_found; took: 0:00:00.000034
    DEBUG: Trying rule: fix_alt_space; took: 0:00:00.000023
    DEBUG: Trying rule: fix_file; took: 0:00:00.000181
    DEBUG: Trying rule: gem_unknown_command; took: 0:00:00.000059
    DEBUG: Trying rule: git_add; took: 0:00:00.000038
    DEBUG: Trying rule: git_add_force; took: 0:00:00.000027
    DEBUG: Trying rule: git_bisect_usage; took: 0:00:00.000026
    DEBUG: Trying rule: git_branch_delete; took: 0:00:00.000023
    DEBUG: Trying rule: git_branch_delete_checked_out; took: 0:00:00.000031
    DEBUG: Trying rule: git_branch_exists; took: 0:00:00.000021
    DEBUG: Trying rule: git_branch_list; took: 0:00:00.000026
    DEBUG: Trying rule: git_checkout; took: 0:00:00.000040
    DEBUG: Trying rule: git_clone_git_clone; took: 0:00:00.000017
    DEBUG: Trying rule: git_commit_amend; took: 0:00:00.000015
    DEBUG: Trying rule: git_commit_reset; took: 0:00:00.000021
    DEBUG: Trying rule: git_diff_no_index; took: 0:00:00.000025
    DEBUG: Trying rule: git_diff_staged; took: 0:00:00.000019
    DEBUG: Trying rule: git_fix_stash; took: 0:00:00.000015
    DEBUG: Trying rule: git_flag_after_filename; took: 0:00:00.000015
    DEBUG: Trying rule: git_help_aliased; took: 0:00:00.000015
    DEBUG: Trying rule: git_lfs_mistype; took: 0:00:00.000014
    DEBUG: Trying rule: git_merge; took: 0:00:00.000019
    DEBUG: Trying rule: git_merge_unrelated; took: 0:00:00.000015
    DEBUG: Trying rule: git_not_command; took: 0:00:00.000015
    DEBUG: Trying rule: git_pull; took: 0:00:00.000014
    DEBUG: Trying rule: git_pull_clone; took: 0:00:00.000015
    DEBUG: Trying rule: git_pull_uncommitted_changes; took: 0:00:00.000015
    DEBUG: Trying rule: git_push; took: 0:00:00.000015
    DEBUG: Trying rule: git_push_different_branch_names; took: 0:00:00.000015
    DEBUG: Trying rule: git_push_pull; took: 0:00:00.000017
    DEBUG: Trying rule: git_push_without_commits; took: 0:00:00.000015
    DEBUG: Trying rule: git_rebase_merge_dir; took: 0:00:00.000015
    DEBUG: Trying rule: git_rebase_no_changes; took: 0:00:00.000016
    DEBUG: Trying rule: git_remote_delete; took: 0:00:00.000023
    DEBUG: Trying rule: git_remote_seturl_add; took: 0:00:00.000022
    DEBUG: Trying rule: git_rm_local_modifications; took: 0:00:00.000045
    DEBUG: Trying rule: git_rm_recursive; took: 0:00:00.000025
    DEBUG: Trying rule: git_rm_staged; took: 0:00:00.000029
    DEBUG: Trying rule: git_stash; took: 0:00:00.000035
    DEBUG: Trying rule: git_tag_force; took: 0:00:00.000027
    DEBUG: Trying rule: git_two_dashes; took: 0:00:00.000025
    DEBUG: Trying rule: go_run; took: 0:00:00.000032
    DEBUG: Trying rule: go_unknown_command; took: 0:00:00.000025
    DEBUG: Trying rule: gradle_no_task; took: 0:00:00.000031
    DEBUG: Trying rule: gradle_wrapper; took: 0:00:00.000033
    DEBUG: Trying rule: grep_arguments_order; took: 0:00:00.000028
    DEBUG: Trying rule: grep_recursive; took: 0:00:00.000026
    DEBUG: Trying rule: grunt_task_not_found; took: 0:00:00.000027
    DEBUG: Trying rule: gulp_not_task; took: 0:00:00.000029
    DEBUG: Trying rule: has_exists_script; took: 0:00:00.000053
    DEBUG: Trying rule: heroku_multiple_apps; took: 0:00:00.000030
    DEBUG: Trying rule: heroku_not_command; took: 0:00:00.000033
    DEBUG: Trying rule: hostscli; took: 0:00:00.000040
    DEBUG: Trying rule: ifconfig_device_not_found; took: 0:00:00.000040
    DEBUG: Trying rule: java; took: 0:00:00.000032
    DEBUG: Trying rule: javac; took: 0:00:00.000025
    DEBUG: Trying rule: lein_not_task; took: 0:00:00.000047
    DEBUG: Trying rule: ln_no_hard_link; took: 0:00:00.000016
    DEBUG: Trying rule: ln_s_order; took: 0:00:00.000015
    DEBUG: Trying rule: ls_all; took: 0:00:00.000026
    DEBUG: Trying rule: ls_lah; took: 0:00:00.000029
    DEBUG: Trying rule: man; took: 0:00:00.000027
    DEBUG: Trying rule: mercurial; took: 0:00:00.000025
    DEBUG: Trying rule: mkdir_p; took: 0:00:00.000019
    DEBUG: Trying rule: mvn_no_command; took: 0:00:00.000026
    DEBUG: Trying rule: mvn_unknown_lifecycle_phase; took: 0:00:00.000022
    DEBUG: Trying rule: no_such_file; took: 0:00:00.001031
    DEBUG: Trying rule: npm_missing_script; took: 0:00:00.000066
    DEBUG: Trying rule: npm_run_script; took: 0:00:00.000032
    DEBUG: Trying rule: npm_wrong_command; took: 0:00:00.000039
    DEBUG: Trying rule: open; took: 0:00:00.000032
    DEBUG: Trying rule: pacman_invalid_option; took: 0:00:00.000042
    DEBUG: Trying rule: php_s; took: 0:00:00.000026
    DEBUG: Trying rule: pip_install; took: 0:00:00.000038
    DEBUG: Trying rule: pip_unknown_command; took: 0:00:00.000050
    DEBUG: Trying rule: port_already_in_use; took: 0:00:00.000741
    DEBUG: Trying rule: prove_recursively; took: 0:00:00.000069
    DEBUG: Trying rule: pyenv_no_such_command; took: 0:00:00.000053
    DEBUG: Trying rule: python_command; took: 0:00:00.000018
    DEBUG: Trying rule: python_execute; took: 0:00:00.000023
    DEBUG: Trying rule: python_module_error; took: 0:00:00.000003
    DEBUG: Trying rule: quotation_marks; took: 0:00:00.000001
    DEBUG: Trying rule: react_native_command_unrecognized; took: 0:00:00.000026
    DEBUG: Trying rule: remove_shell_prompt_literal; took: 0:00:00.000003
    DEBUG: Trying rule: remove_trailing_cedilla; took: 0:00:00.000004
    DEBUG: Trying rule: rm_dir; took: 0:00:00.000016
    DEBUG: Trying rule: scm_correction; took: 0:00:00.000029
    DEBUG: Trying rule: sed_unterminated_s; took: 0:00:00.000030
    DEBUG: Trying rule: sl_ls; took: 0:00:00.000003
    DEBUG: Trying rule: ssh_known_hosts; took: 0:00:00.000029
    DEBUG: Trying rule: sudo; took: 0:00:00.000043
    DEBUG: Trying rule: sudo_command_from_user_path; took: 0:00:00.000037
    DEBUG: Trying rule: switch_lang; took: 0:00:00.000003
    DEBUG: Trying rule: systemctl; took: 0:00:00.000049
    DEBUG: Trying rule: terraform_init; took: 0:00:00.000033
    DEBUG: Trying rule: tmux; took: 0:00:00.000035
    DEBUG: Trying rule: touch; took: 0:00:00.000033
    DEBUG: Trying rule: tsuru_login; took: 0:00:00.000037
    DEBUG: Trying rule: tsuru_not_command; took: 0:00:00.000026
    DEBUG: Trying rule: unknown_command; took: 0:00:00.000705
    DEBUG: Trying rule: unsudo; took: 0:00:00.000006
    DEBUG: Trying rule: vagrant_up; took: 0:00:00.000056
    DEBUG: Trying rule: whois; took: 0:00:00.000038
    DEBUG: Trying rule: workon_doesnt_exists; took: 0:00:00.000040
    DEBUG: Trying rule: yarn_alias; took: 0:00:00.000030
    DEBUG: Trying rule: yarn_command_not_found; took: 0:00:00.000025
    DEBUG: Trying rule: yarn_command_replaced; took: 0:00:00.000025
    DEBUG: Trying rule: yarn_help; took: 0:00:00.000029
    DEBUG: Trying rule: yum_invalid_operation; took: 0:00:00.000045
    DEBUG: Trying rule: man_no_space; took: 0:00:00.000002
    DEBUG: Trying rule: no_command; took: 0:00:00.000138
    DEBUG: Trying rule: missing_space_before_subcommand; took: 0:00:00.042224
    DEBUG: Trying rule: long_form_help; took: 0:00:00.000379
    fish -ic "git push" [enter/↑/↓/ctrl+c]
    Aborted
    DEBUG: Total took: 0:00:02.887527
    

    If the bug only appears with a specific application, the output of that application and its version:

    git version 2.33.1
    

    Anything else you think is relevant:

    TF_SHELL=fish thefuck git push THEFUCK_ARGUMENT_PLACEHOLDER # does not work
    TF_SHELL=bash thefuck git push THEFUCK_ARGUMENT_PLACEHOLDER # works
    
    fish 
    opened by septatrix 19
Releases(3.32)
  • 3.32(Jan 2, 2022)

    • Addition of new rules
      • #942: Add new git_branch_0v_to_dash_v rule
      • #1210: Add rule 'rails_migrations_pending'
      • #1131: Add rule for Git commit with no added files
      • #1184: Add new rule for main / master Git branches
      • #977: Add wrong_hyphen_before_subcommand rule
    • Improvements to existing rules
      • #1039: Remove all leading $ not just one
      • #1123: Update composer_not_command rule (#1135)
      • #942: Improve git_branch_0flag rule - with a new name
      • #1131: Improve git_commit_add rule
      • #1184: Improve + fix git_main_master rule
      • #894: Combine commands with shell.and_ in docker_login rule
      • #618: Fix git_push_without_commits rule
      • #933: Correctly redefine the function with a cache
      • #579: Ignore commands of len 1 in missing_space_before_subcommand
      • #1227: Make git_support support output-independent rules
    • Improvements to documentation and development experience
      • Fix git_hook_bypass priority (#1207)
      • #1164: Optimize GIFs with ImgBot
      • #N/A: Fix grammar and spelling errors (#1193)
      • #455: [README] Add uninstall instructions (#1171)
      • #1150: Update the name of macOS on README
      • #1109: Fix a typo on a comment
      • #1184: Add devcontainer for easy Python development
      • #1184: Configure devcontainer shell with recommended way
      • #868: Fix outdated link to homebrew for Linux (#1226)
      • #1233: Use --user with pip, not sudo pip
    • Bug fixes
      • Avoid using pkg_resources
      • #N/A: Fix yield_fixture deprecation (#1211)
      • #1133: Match commands with path prefixes in @for_app decorations
      • #1215: Remove redirection to stderr with the ^ character
      • #1215: Initiate settings before printing the alias
      • #N/A: Replace only exact words when expanding a Git alias
      • #994: Replace decoding errors with the replacement marker
      • #1188: Remove only leading whitespace chars from script
      • #697: Encode expanded script on Python 2
      • #1250: Encapsulate force_command in _get_raw_command
    Source code(tar.gz)
    Source code(zip)
  • 3.31(Jun 9, 2021)

    • add excluded_search_path_prefixes setting #1165
    • add cd_cs rule #1167
    • extend pyenv rule to include goenv, nodenv and rbenv #1100
    • add conda rule #1138
    • add python_module_error rule #1151
    • fix possible changes in files outside of working directory in dirty_unzip and dirty_untar rules #1206
    • various improvements and bugfixes
    Source code(tar.gz)
    Source code(zip)
  • 3.30(Mar 19, 2020)

    • new nixos_cmd_not_found rule (#912, #922)
    • new terraform_init rule (#924)
    • new docker_image_being_used_by_container rule (#925, #928)
    • new go_unknown_command rule (#933)
    • new yum_invalid_operation rule (#968)
    • new git_branch_delete_checked_out rule (#985)
    • new remove_shell_prompt_literal rule (#996)
    • new choco_install rule (#998)
    • new cp_create_destination rule (#1061)
    • Korean support in switch_lang rule (#880, #981)
    • fix recursive shell nesting (#921, #923)
    • fix support of non-English output in apt_list_upgradable (#931)
    • fix git_checkout with git 2.22.0 (#934)
    • fix docker_not_command with newer docker versions (#937, #940)
    • fix rules_git_checkout with branches with slashes (#944)
    • fix apt_invalid_operation behaviour with apt uninstall (#950)
    • fix slow commands time out (#961)
    • fix powershell support (#1004)
    • fix apt_invalid_operation with newer apt-get versions (#1031)
    • fix pip_unknown_command (#1047, #1059)
    Source code(tar.gz)
    Source code(zip)
  • 3.29(May 27, 2019)

    • new pyenv_no_such_command rule (#918)
    • new pip_install rule (#895)
    • new docker_login rule (#894)
    • new git_commit_reset rule (#886)
    • yay support in pacman and pacman_not_found rules (#907)
    • Greek support in switch_lang rule (#862, #864)
    • support of -y/--yeah command line args in Fish Shell (#900)
    • improved fetching of shells version (#920)
    • improved windows support (#902, #917)
    • bugfixes (#861, #869, #872, #874)
    Source code(tar.gz)
    Source code(zip)
  • 3.28(Nov 29, 2018)

    • Ukrainian layout support in switch_lang rule (#855)
    • pwsh support (#844)
    • BSD style output support in touch rule (#360)
    • --yeah as an alternative arg to -y and --yes (#822)
    • bug fixes: #854, #835, #842, #827, #820, #818, #819
    Source code(tar.gz)
    Source code(zip)
  • 3.27(May 22, 2018)

  • 3.26(Apr 25, 2018)

    • Ubuntu 18.04 support (#786)
    • Improved fish alias (#727)
    • New unsudo rule (#787)
    • New git_merge_unrelated rule (#773)
    • New git_commit_amend rule (#664)
    • New adb_unknown_command rule (#765)
    • New apt_upgrade rule (#761)
    • New git_merge rule (#629)
    • Improved cd_mkdir rule (#784)
    • Improved cd_correction rule (#784)
    • Improved switch_lang rule (#776)
    • Improved git_branch_exists rule (#762)
    • Improved git_push rule (#740)
    • Improved git_checkout rule (#632)
    • No longer rely on $SHELL for detecting shell (#783)
    Source code(tar.gz)
    Source code(zip)
  • 3.25(Nov 23, 2017)

    • add support of third-party packages with rules (#737);
    • fix Windows support (#715);
    • fix zsh alias (#733);
    • new rule: heroku_multiple_apps – add --app <app> to heroku commands like heroku pg (#729);
    • new rule: apt_list_upgradable – helps you run apt list --upgradable after apt update (#732);
    • minor bug fixes.
    Source code(tar.gz)
    Source code(zip)
  • 3.24(Oct 16, 2017)

    • instant fuck mode support on macOS (#682);
    • command selection with ctrl+n and ctrl+p instead of and (#711);
    • improvements in cache (#707);
    • fixed exception in python3 + fish (#708);
    • fixed configuration code for fish shell (#658);
    • support parameters in PowerShell (#696);
    • rules api changed, Command.output instead of stdout/stderr (#682, #691);
    • multiline PS1 with instant mode (#692);
    • add php_s rule that replaces -s by -S when trying to run a local php server (#655);
    • add dnf_no_such_command rule that fixes mistyped DNF commands (#698);
    • add git_remote_delete rule that replaces git remote delete remote_name with git remote remove remote_name (#670);
    • add git_push_different_branch_names rule that fixes pushes when local brach name does not match remote branch name (#652);
    • add prove_recursively rule that adds -r when called with directory;
    • add brew_cask_dependency rule that installs cask dependencies;
    • fix brew_update_formula rule (#710).
    Source code(tar.gz)
    Source code(zip)
  • 3.23(Aug 29, 2017)

  • 3.22(Aug 28, 2017)

  • 3.21(Aug 21, 2017)

    Before:

    thefuck git br THEFUCK_ARGUMENT_PLACEHOLDER -y  0,36s user 0,02s system 97% cpu 0,383 total
    thefuck --alias  0,29s user 0,01s system 99% cpu 0,303 total
    

    After:

    thefuck git br THEFUCK_ARGUMENT_PLACEHOLDER -y  0,19s user 0,03s system 94% cpu 0,234 total
    thefuck --alias  0,13s user 0,02s system 99% cpu 0,149 total
    
    Source code(tar.gz)
    Source code(zip)
  • 3.20(Aug 16, 2017)

  • 3.19(Aug 3, 2017)

  • 3.18(May 10, 2017)

  • 3.17(May 10, 2017)

    • fix support of bash aliases (#549, #645)
    • appropriate message instead of "No fucks given" when alias isn't fuck (#635)
    • fix encoding with bash (#643)
    • fix suggestion on yarn require ... (#637)
    Source code(tar.gz)
    Source code(zip)
  • 3.16(Apr 10, 2017)

    • Repeated fucking fucks up with UnicodeDecodeError (Python 2.7.6) #623
    • Improve handling of command line arguments #620
    • idea: fuck-it repeatedly until command works #614
    • allow for a flag that executes immediately #531
    • Please put eval $(thefuck --alias) in your ~/.zshrc. #585
    Source code(tar.gz)
    Source code(zip)
Owner
Vladimir Iakovlev
Software Developer
Vladimir Iakovlev
:zap: A new cd command that helps you navigate faster by learning your habits.

z.lua A command line tool which helps you navigate faster by learning your habits ⚡ An alternative to z.sh with windows and posix shells support and v

Linwei 2.2k Jan 18, 2022
A smarter cd command for your terminal

zoxide A smarter cd command for your terminal zoxide is a blazing fast replacement for your cd command, inspired by z and z.lua. It keeps track of the

Ajeet D'Souza 4.6k Dec 25, 2021
A Ruby gem that beautifies the terminal's ls command, with color and font-awesome icons. :tada:

Color LS A Ruby script that colorizes the ls output with color and icons. Here are the screenshots of working example on an iTerm2 terminal (Mac OS),

Athitya Kumar 3.9k Jan 13, 2022
Command line radio player

Curseradio Internet radio in the terminal Curseradio is a curses interface for browsing and playing an OPML directory of internet radio streams. It is

Gordon Ball 169 Jan 7, 2022
:cherry_blossom: A command-line fuzzy finder

fzf is a general-purpose command-line fuzzy finder. It's an interactive Unix filter for command-line that can be used with any list; files, command hi

Junegunn Choi 41.5k Jan 14, 2022
Command-line program to download image galleries and collections from several image hosting sites

gallery-dl gallery-dl is a command-line program to download image galleries and collections from several image hosting sites (see Supported Sites). It

Mike Fährmann 4.4k Jan 20, 2022
A command-line benchmarking tool

hyperfine 中文 A command-line benchmarking tool. Demo: Benchmarking fd and find: Features Statistical analysis across multiple runs. Support for arbitra

David Peter 10k Jan 20, 2022
Quick and simple image processing at the command line. :hammer:

Korkut Quick and simple image processing at the command line. Getting started First download and install ImageMagick. Mac OS X ImageMagick supports th

Oguzhan Inan 335 Jan 5, 2022
The next gen ls command

LSD (LSDeluxe) Table of Contents Description Screenshot Installation Configuration External Configurations Required Optional F.A.Q. Contributors Credi

Pierre Peltier 6.8k Jan 1, 2022
🖼️ A command-line system information tool written in bash 3.2+

A command-line system information tool written in bash 3.2+ Neofetch is a command-line system information tool written in bash 3.2+. Neofetch displays

dylan 14.1k Jan 18, 2022
:speech_balloon: Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc.

Translate Shell Translate Shell (formerly Google Translate CLI) is a command-line translator powered by Google Translate (default), Bing Translator, Y

Mort Yao 5.4k Jan 24, 2022
A fast CSV command line toolkit written in Rust.

xsv is a command line program for indexing, slicing, analyzing, splitting and joining CSV files. Commands should be simple, fast and composable: Simpl

Andrew Gallant 7.9k Jan 21, 2022
Command-line program to download videos from YouTube.com and other video sites

youtube-dl - download videos from youtube.com or other video platforms INSTALLATION DESCRIPTION OPTIONS CONFIGURATION OUTPUT TEMPLATE FORMAT SELECTION

youtube-dl 105k Jan 17, 2022
Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.

Glances - An eye on your system Summary Glances is a cross-platform monitoring tool which aims to present a large amount of monitoring information thr

Nicolas Hennion 19.8k Jan 17, 2022
Git repository summary on your terminal

A command-line Git information tool written in Rust Onefetch is a command-line Git information tool written in Rust that displays project information

Ossama Hjaji 3.7k Jan 17, 2022
Browse Reddit from your terminal

THIS PROJECT IS NO LONGER MAINTAINED RTV Development is Shutting Down List of Alternative Projects Reddit Terminal Viewer (RTV) A text-based interface

Michael Lazar 4.6k Jan 15, 2022
Source CodeMatrix Console Web - Web client meant to be a showcase of Matrix capabilities, and reference implementation of the Matrix standard. () Apache-2.0 Javascript

Matrix Angular SDK !DANGER! matrix-angular-sdk is not currently being maintained or developed by the core team, and whilst stable it has some serious

matrix.org 28 Nov 14, 2021
Small, fast and powerful console music player for Unix-like operating systems.

Warning: cmus is not actively maintained. For details, please see #856 cmus — C* Music Player https://cmus.github.io/ Copyright © 2004-2008 Timo Hirvo

C* Music Player 4.5k Jan 16, 2022
A VIM-inspired filemanager for the console

ranger 1.9.3 ranger is a console file manager with VI key bindings. It provides a minimalistic and nice curses interface with a view on the directory

null 10.8k Jan 16, 2022
A habit tracker app which treats your goals like a Role Playing Game.

Habitica Habitica is an open source habit building program which treats your life like a Role Playing Game. Level up as you succeed, lose HP as you fa

HabitRPG 8.8k Jan 13, 2022
A habit tracker app which treats your goals like a Role Playing Game.

Habitica Habitica is an open source habit building program which treats your life like a Role Playing Game. Level up as you succeed, lose HP as you fa

HabitRPG 8.8k Jan 15, 2022
📺 a Youtube-like (without censorship and features you don't need!) Video Sharing App written in Go which also supports automatic transcoding to MP4 H.265 AAC, multiple collections and RSS feed

tube tube is a Youtube-like (without censorship and features you don't need!) Video Sharing App written in Go which also supports automatic transcodin

James Mills 4 Dec 24, 2021
A colour picker app for Ubuntu and Linux which allows picking any colour on the screen

Pick A colour picker app for Ubuntu and Linux which allows picking any colour on the screen and remembers the last few you picked. Made with ?? for Bu

Stuart Langridge 242 Jan 17, 2022
Accelerated Text is a no-code natural language generation platform. It will help you construct document plans which define how your data is converted to textual descriptions varying in wording and structure.

A picture is worth a thousand words. Or is it? Tables, charts, pictures are all useful in understanding our data but often we need a description – a s

TokenMill 425 Jan 16, 2022
:zap: A new cd command that helps you navigate faster by learning your habits.

z.lua A command line tool which helps you navigate faster by learning your habits ⚡ An alternative to z.sh with windows and posix shells support and v

Linwei 2.2k Jan 18, 2022