repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/brew_uninstall.py | thefuck/rules/brew_uninstall.py | from thefuck.utils import for_app
@for_app('brew', at_least=2)
def match(command):
return (command.script_parts[1] in ['uninstall', 'rm', 'remove']
and "brew uninstall --force" in command.output)
def get_new_command(command):
command_parts = command.script_parts[:]
command_parts[1] = 'uninst... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/whois.py | thefuck/rules/whois.py | # -*- encoding: utf-8 -*-
from six.moves.urllib.parse import urlparse
from thefuck.utils import for_app
@for_app('whois', at_least=1)
def match(command):
"""
What the `whois` command returns depends on the 'Whois server' it contacted
and is not consistent through different servers. But there can be only t... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/wrong_hyphen_before_subcommand.py | thefuck/rules/wrong_hyphen_before_subcommand.py | from thefuck.utils import get_all_executables
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
first_part = command.script_parts[0]
if "-" not in first_part or first_part in get_all_executables():
return False
cmd, _ = first_part.split("-", 1)
return cmd in get_... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_diff_no_index.py | thefuck/rules/git_diff_no_index.py | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
files = [arg for arg in command.script_parts[2:]
if not arg.startswith('-')]
return ('diff' in command.script
and '--no-index' not in command.script
and... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/sl_ls.py | thefuck/rules/sl_ls.py | """
This happens way too often
When typing really fast cause I'm a 1337 H4X0R,
I often fuck up 'ls' and type 'sl'. No more!
"""
def match(command):
return command.script == 'sl'
def get_new_command(command):
return 'ls'
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/history.py | thefuck/rules/history.py | from thefuck.utils import get_close_matches, get_closest, \
get_valid_history_without_current
def match(command):
return len(get_close_matches(command.script,
get_valid_history_without_current(command)))
def get_new_command(command):
return get_closest(command.script,
... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/brew_cask_dependency.py | thefuck/rules/brew_cask_dependency.py | from thefuck.utils import for_app, eager
from thefuck.shells import shell
from thefuck.specific.brew import brew_available
@for_app('brew')
def match(command):
return (u'install' in command.script_parts
and u'brew cask install' in command.output)
@eager
def _get_cask_install_lines(output):
for l... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/gradle_no_task.py | thefuck/rules/gradle_no_task.py | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, eager, replace_command
regex = re.compile(r"Task '(.*)' (is ambiguous|not found)")
@for_app('gradle', 'gradlew')
def match(command):
return regex.findall(command.output)
@eager
def _get_all_tasks(gradle):
proc = Popen([gradle, ... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/adb_unknown_command.py | thefuck/rules/adb_unknown_command.py | from thefuck.utils import is_app, get_closest, replace_argument
_ADB_COMMANDS = (
'backup',
'bugreport',
'connect',
'devices',
'disable-verity',
'disconnect',
'enable-verity',
'emu',
'forward',
'get-devpath',
'get-serialno',
'get-state',
'install',
'install-mult... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/pacman_invalid_option.py | thefuck/rules/pacman_invalid_option.py | from thefuck.specific.archlinux import archlinux_env
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app
import re
@sudo_support
@for_app("pacman")
def match(command):
return command.output.startswith("error: invalid option '-") and any(
" -{}".format(option) in command.script... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/sudo_command_from_user_path.py | thefuck/rules/sudo_command_from_user_path.py | import re
from thefuck.utils import for_app, which, replace_argument
def _get_command_name(command):
found = re.findall(r'sudo: (.*): command not found', command.output)
if found:
return found[0]
@for_app('sudo')
def match(command):
if 'command not found' in command.output:
command_name ... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_branch_delete_checked_out.py | thefuck/rules/git_branch_delete_checked_out.py | from thefuck.shells import shell
from thefuck.specific.git import git_support
from thefuck.utils import replace_argument
@git_support
def match(command):
return (
("branch -d" in command.script or "branch -D" in command.script)
and "error: Cannot delete branch '" in command.output
and "' c... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/grep_arguments_order.py | thefuck/rules/grep_arguments_order.py | import os
from thefuck.utils import for_app
def _get_actual_file(parts):
for part in parts[1:]:
if os.path.isfile(part) or os.path.isdir(part):
return part
@for_app('grep', 'egrep')
def match(command):
return ': No such file or directory' in command.output \
and _get_actual_file(... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/npm_missing_script.py | thefuck/rules/npm_missing_script.py | import re
from thefuck.utils import for_app, replace_command
from thefuck.specific.npm import get_scripts, npm_available
enabled_by_default = npm_available
@for_app('npm')
def match(command):
return (any(part.startswith('ru') for part in command.script_parts)
and 'npm ERR! missing script: ' in comman... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/heroku_not_command.py | thefuck/rules/heroku_not_command.py | import re
from thefuck.utils import for_app
@for_app('heroku')
def match(command):
return 'Run heroku _ to run' in command.output
def get_new_command(command):
return re.findall('Run heroku _ to run ([^.]*)', command.output)[0]
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_remote_delete.py | thefuck/rules/git_remote_delete.py | import re
from thefuck.specific.git import git_support
@git_support
def match(command):
return "remote delete" in command.script
@git_support
def get_new_command(command):
return re.sub(r"delete", "remove", command.script, 1)
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_branch_delete.py | thefuck/rules/git_branch_delete.py | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('branch -d' in command.script
and 'If you are sure you want to delete it' in command.output)
@git_support
def get_new_command(command):
return replace_argument(command... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_commit_amend.py | thefuck/rules/git_commit_amend.py | from thefuck.specific.git import git_support
@git_support
def match(command):
return ('commit' in command.script_parts)
@git_support
def get_new_command(command):
return 'git commit --amend'
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/switch_lang.py | thefuck/rules/switch_lang.py | # -*- encoding: utf-8 -*-
from thefuck.utils import memoize, get_alias
target_layout = '''qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?'''
# any new keyboard layout must be appended
greek = u''';ςερτυθιοπ[]ασδφγηξκλ΄ζχψωβνμ,./:΅ΕΡΤΥΘΙΟΠ{}ΑΣΔΦΓΗΞΚΛ¨"ΖΧΨΩΒΝΜ<>?'''
korean = u'''ㅂㅈㄷㄱㅅㅛㅕㅑㅐㅔ[]ㅁㄴㅇㄹㅎㅗㅓㅏㅣ... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/gem_unknown_command.py | thefuck/rules/gem_unknown_command.py | import re
import subprocess
from thefuck.utils import for_app, eager, replace_command, cache, which
@for_app('gem')
def match(command):
return ('ERROR: While executing gem ... (Gem::CommandLineError)'
in command.output
and 'Unknown command' in command.output)
def _get_unknown_command(co... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/pip_unknown_command.py | thefuck/rules/pip_unknown_command.py | import re
from thefuck.utils import replace_argument, for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('pip', 'pip2', 'pip3')
def match(command):
return ('pip' in command.script and
'unknown command' in command.output and
'maybe you meant' in command.output)
... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/chmod_x.py | thefuck/rules/chmod_x.py | import os
from thefuck.shells import shell
def match(command):
return (command.script.startswith('./')
and 'permission denied' in command.output.lower()
and os.path.exists(command.script_parts[0])
and not os.access(command.script_parts[0], os.X_OK))
def get_new_command(comman... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/go_unknown_command.py | thefuck/rules/go_unknown_command.py | from itertools import dropwhile, islice, takewhile
import subprocess
from thefuck.utils import get_closest, replace_argument, for_app, which, cache
def get_golang_commands():
proc = subprocess.Popen('go', stderr=subprocess.PIPE)
lines = [line.decode('utf-8').strip() for line in proc.stderr.readlines()]
l... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/yarn_command_replaced.py | thefuck/rules/yarn_command_replaced.py | import re
from thefuck.utils import for_app
regex = re.compile(r'Run "(.*)" instead')
@for_app('yarn', at_least=1)
def match(command):
return regex.findall(command.output)
def get_new_command(command):
return regex.findall(command.output)[0]
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/choco_install.py | thefuck/rules/choco_install.py | from thefuck.utils import for_app, which
@for_app("choco", "cinst")
def match(command):
return ((command.script.startswith('choco install') or 'cinst' in command.script_parts)
and 'Installing the following packages' in command.output)
def get_new_command(command):
# Find the argument that is the... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_stash.py | thefuck/rules/git_stash.py | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
# catches "Please commit or stash them" and "Please, commit your changes or
# stash them before you can switch branches."
return 'or stash them' in command.output
@git_support
def get_new_comma... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/path_from_history.py | thefuck/rules/path_from_history.py | from collections import Counter
import re
from thefuck.system import Path
from thefuck.utils import (get_valid_history_without_current,
memoize, replace_argument)
from thefuck.shells import shell
patterns = [r'no such file or directory: (.*)$',
r"cannot access '(.*)': No such fi... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_help_aliased.py | thefuck/rules/git_help_aliased.py | from thefuck.specific.git import git_support
@git_support
def match(command):
return 'help' in command.script and ' is aliased to ' in command.output
@git_support
def get_new_command(command):
aliased = command.output.split('`', 2)[2].split("'", 1)[0].split(' ', 1)[0]
return 'git help {}'.format(aliased... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/heroku_multiple_apps.py | thefuck/rules/heroku_multiple_apps.py | import re
from thefuck.utils import for_app
@for_app('heroku')
def match(command):
return 'https://devcenter.heroku.com/articles/multiple-environments' in command.output
def get_new_command(command):
apps = re.findall('([^ ]*) \\([^)]*\\)', command.output)
return [command.script + ' --app ' + app for ap... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/cd_correction.py | thefuck/rules/cd_correction.py | """Attempts to spellcheck and correct failed cd commands"""
import os
import six
from thefuck.specific.sudo import sudo_support
from thefuck.rules import cd_mkdir
from thefuck.utils import for_app, get_close_matches
__author__ = "mmussomele"
MAX_ALLOWED_DIFF = 0.6
def _get_sub_dirs(parent):
"""Returns a list o... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_not_command.py | thefuck/rules/git_not_command.py | import re
from thefuck.utils import get_all_matched_commands, replace_command
from thefuck.specific.git import git_support
@git_support
def match(command):
return (" is not a git command. See 'git --help'." in command.output
and ('The most similar command' in command.output
or 'Did yo... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/django_south_ghost.py | thefuck/rules/django_south_ghost.py | def match(command):
return 'manage.py' in command.script and \
'migrate' in command.script \
and 'or pass --delete-ghost-migrations' in command.output
def get_new_command(command):
return u'{} --delete-ghost-migrations'.format(command.script)
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/touch.py | thefuck/rules/touch.py | import re
from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('touch')
def match(command):
return 'No such file or directory' in command.output
def get_new_command(command):
path = re.findall(
r"touch: (?:cannot touch ')?(.+)/.+'?:", command.output)[0]
return shell.and_(u... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_rebase_no_changes.py | thefuck/rules/git_rebase_no_changes.py | from thefuck.specific.git import git_support
@git_support
def match(command):
return (
{'rebase', '--continue'}.issubset(command.script_parts) and
'No changes - did you forget to use \'git add\'?' in command.output
)
def get_new_command(command):
return 'git rebase --skip'
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/unknown_command.py | thefuck/rules/unknown_command.py | import re
from thefuck.utils import replace_command
def match(command):
return (re.search(r"([^:]*): Unknown command.*", command.output) is not None
and re.search(r"Did you mean ([^?]*)?", command.output) is not None)
def get_new_command(command):
broken_cmd = re.findall(r"([^:]*): Unknown comma... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/missing_space_before_subcommand.py | thefuck/rules/missing_space_before_subcommand.py | from thefuck.utils import get_all_executables, memoize
@memoize
def _get_executable(script_part):
for executable in get_all_executables():
if len(executable) > 1 and script_part.startswith(executable):
return executable
def match(command):
return (not command.script_parts[0] in get_all_e... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_add_force.py | thefuck/rules/git_add_force.py | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('add' in command.script_parts
and 'Use -f if you really want to add them.' in command.output)
@git_support
def get_new_command(command):
return replace_argument(comman... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/dry.py | thefuck/rules/dry.py | def match(command):
split_command = command.script_parts
return (split_command
and len(split_command) >= 2
and split_command[0] == split_command[1])
def get_new_command(command):
return ' '.join(command.script_parts[1:])
# it should be rare enough to actually have to type twice ... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_rm_local_modifications.py | thefuck/rules/git_rm_local_modifications.py | from thefuck.specific.git import git_support
@git_support
def match(command):
return (' rm ' in command.script and
'error: the following file has local modifications' in command.output and
'use --cached to keep the file, or -f to force removal' in command.output)
@git_support
def get_new... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/fix_file.py | thefuck/rules/fix_file.py | import re
import os
from thefuck.utils import memoize, default_settings
from thefuck.conf import settings
from thefuck.shells import shell
# order is important: only the first match is considered
patterns = (
# js, node:
'^ at {file}:{line}:{col}',
# cargo:
'^ {file}:{line}:{col}',
# python, ... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/terraform_init.py | thefuck/rules/terraform_init.py | from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('terraform')
def match(command):
return ('this module is not yet installed' in command.output.lower() or
'initialization required' in command.output.lower()
)
def get_new_command(command):
return shell.and_('... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_pull_clone.py | thefuck/rules/git_pull_clone.py | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('fatal: Not a git repository' in command.output
and "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)." in command.output)
@git_support
def get_ne... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_fix_stash.py | thefuck/rules/git_fix_stash.py | from thefuck import utils
from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
if command.script_parts and len(command.script_parts) > 1:
return (command.script_parts[1] == 'stash'
and 'usage:' in command.output)
else:... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/grep_recursive.py | thefuck/rules/grep_recursive.py | from thefuck.utils import for_app
@for_app('grep')
def match(command):
return 'is a directory' in command.output.lower()
def get_new_command(command):
return u'grep -r {}'.format(command.script[5:])
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/dirty_unzip.py | thefuck/rules/dirty_unzip.py | import os
import zipfile
from thefuck.utils import for_app
from thefuck.shells import shell
def _is_bad_zip(file):
try:
with zipfile.ZipFile(file, 'r') as archive:
return len(archive.namelist()) > 1
except Exception:
return False
def _zip_file(command):
# unzip works that way... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_checkout.py | thefuck/rules/git_checkout.py | import re
import subprocess
from thefuck import utils
from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
from thefuck.shells import shell
@git_support
def match(command):
return ('did not match any file(s) known to git' in command.output
and "Did you forget to 'git... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_clone_missing.py | thefuck/rules/git_clone_missing.py | '''
Rule: git_clone_missing
Correct missing `git clone` command when pasting a git URL
```sh
>>> https://github.com/nvbn/thefuck.git
git clone https://github.com/nvbn/thefuck.git
```
Author: Miguel Guthridge
'''
from six.moves.urllib import parse
from thefuck.utils import which
def match(command):
# We want it... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/nixos_cmd_not_found.py | thefuck/rules/nixos_cmd_not_found.py | import re
from thefuck.specific.nix import nix_available
from thefuck.shells import shell
regex = re.compile(r'nix-env -iA ([^\s]*)')
enabled_by_default = nix_available
def match(command):
return regex.findall(command.output)
def get_new_command(command):
name = regex.findall(command.output)[0]
return ... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/yarn_help.py | thefuck/rules/yarn_help.py | import re
from thefuck.utils import for_app
from thefuck.system import open_command
@for_app('yarn', at_least=2)
def match(command):
return (command.script_parts[1] == 'help'
and 'for documentation about this command.' in command.output)
def get_new_command(command):
url = re.findall(
r'... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/cp_create_destination.py | thefuck/rules/cp_create_destination.py | from thefuck.shells import shell
from thefuck.utils import for_app
@for_app("cp", "mv")
def match(command):
return (
"No such file or directory" in command.output
or command.output.startswith("cp: directory")
and command.output.rstrip().endswith("does not exist")
)
def get_new_comman... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_commit_add.py | thefuck/rules/git_commit_add.py | from thefuck.utils import eager, replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return (
"commit" in command.script_parts
and "no changes added to commit" in command.output
)
@eager
@git_support
def get_new_command(command):
for opt in ("-a... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/yum_invalid_operation.py | thefuck/rules/yum_invalid_operation.py | import subprocess
from itertools import dropwhile, islice, takewhile
from thefuck.specific.sudo import sudo_support
from thefuck.specific.yum import yum_available
from thefuck.utils import for_app, replace_command, which, cache
enabled_by_default = yum_available
@sudo_support
@for_app('yum')
def match(command):
... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_push_without_commits.py | thefuck/rules/git_push_without_commits.py | import re
from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
return bool(re.search(r"src refspec \w+ does not match any", command.output))
def get_new_command(command):
return shell.and_('git commit -m "Initial commit"', command.script)
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/has_exists_script.py | thefuck/rules/has_exists_script.py | import os
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
return command.script_parts and os.path.exists(command.script_parts[0]) \
and 'command not found' in command.output
@sudo_support
def get_new_command(command):
return u'./{}'.format(command.script)
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_rm_recursive.py | thefuck/rules/git_rm_recursive.py | from thefuck.specific.git import git_support
@git_support
def match(command):
return (' rm ' in command.script
and "fatal: not removing '" in command.output
and "' recursively without -r" in command.output)
@git_support
def get_new_command(command):
command_parts = command.script_par... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/brew_install.py | thefuck/rules/brew_install.py | import re
from thefuck.utils import for_app
from thefuck.specific.brew import brew_available
enabled_by_default = brew_available
def _get_suggestions(str):
suggestions = str.replace(" or ", ", ").split(", ")
return suggestions
@for_app('brew', at_least=2)
def match(command):
is_proper_command = ('insta... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/lein_not_task.py | thefuck/rules/lein_not_task.py | import re
from thefuck.utils import replace_command, get_all_matched_commands, for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('lein')
def match(command):
return (command.script.startswith('lein')
and "is not a task. See 'lein help'" in command.output
and 'Did... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/apt_get.py | thefuck/rules/apt_get.py | from types import ModuleType
from thefuck.specific.apt import apt_available
from thefuck.utils import memoize, which
from thefuck.shells import shell
try:
from CommandNotFound import CommandNotFound
enabled_by_default = apt_available
if isinstance(CommandNotFound, ModuleType):
# For ubuntu 18.04+... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/java.py | thefuck/rules/java.py | """Fixes common java command mistake
Example:
> java foo.java
Error: Could not find or load main class foo.java
"""
from thefuck.utils import for_app
@for_app('java')
def match(command):
return command.script.endswith('.java')
def get_new_command(command):
return command.script[:-5]
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/cp_omitting_directory.py | thefuck/rules/cp_omitting_directory.py | import re
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app
@sudo_support
@for_app('cp')
def match(command):
output = command.output.lower()
return 'omitting directory' in output or 'is a directory' in output
@sudo_support
def get_new_command(command):
return re.sub(r'^cp'... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/mvn_no_command.py | thefuck/rules/mvn_no_command.py | from thefuck.utils import for_app
@for_app('mvn')
def match(command):
return 'No goals have been specified for this build' in command.output
def get_new_command(command):
return [command.script + ' clean package',
command.script + ' clean install']
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/scm_correction.py | thefuck/rules/scm_correction.py | from thefuck.utils import for_app, memoize
from thefuck.system import Path
path_to_scm = {
'.git': 'git',
'.hg': 'hg',
}
wrong_scm_patterns = {
'git': 'fatal: Not a git repository',
'hg': 'abort: no repository found',
}
@memoize
def _get_actual_scm():
for path, scm in path_to_scm.items():
... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/ln_no_hard_link.py | thefuck/rules/ln_no_hard_link.py | # -*- coding: utf-8 -*-
"""Suggest creating symbolic link if hard link is not allowed.
Example:
> ln barDir barLink
ln: ‘barDir’: hard link not allowed for directory
--> ln -s barDir barLink
"""
import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
return (command.output.en... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/apt_invalid_operation.py | thefuck/rules/apt_invalid_operation.py | import subprocess
from thefuck.specific.apt import apt_available
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app, eager, replace_command
enabled_by_default = apt_available
@sudo_support
@for_app('apt', 'apt-get', 'apt-cache')
def match(command):
return 'E: Invalid operation' in c... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/remove_shell_prompt_literal.py | thefuck/rules/remove_shell_prompt_literal.py | """Fixes error for commands containing one or more occurrences of the shell
prompt symbol '$'.
This usually happens when commands are copied from documentations
including them in their code blocks.
Example:
> $ git clone https://github.com/nvbn/thefuck.git
bash: $: command not found...
"""
import re
def match(comm... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/rm_root.py | thefuck/rules/rm_root.py | from thefuck.specific.sudo import sudo_support
enabled_by_default = False
@sudo_support
def match(command):
return (command.script_parts
and {'rm', '/'}.issubset(command.script_parts)
and '--no-preserve-root' not in command.script
and '--no-preserve-root' in command.output)
... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/php_s.py | thefuck/rules/php_s.py | from thefuck.utils import replace_argument, for_app
@for_app('php', at_least=2)
def match(command):
return ('-s' in command.script_parts
and command.script_parts[-1] != '-s')
def get_new_command(command):
return replace_argument(command.script, "-s", "-S")
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_branch_list.py | thefuck/rules/git_branch_list.py | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
# catches "git branch list" in place of "git branch"
return (command.script_parts
and command.script_parts[1:] == 'branch list'.split())
@git_support
def get_new_command(command):
r... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_push_force.py | thefuck/rules/git_push_force.py | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('push' in command.script
and '! [rejected]' in command.output
and 'failed to push some refs to' in command.output
and 'Updates were rejected because ... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/aws_cli.py | thefuck/rules/aws_cli.py | import re
from thefuck.utils import for_app, replace_argument
INVALID_CHOICE = "(?<=Invalid choice: ')(.*)(?=', maybe you meant:)"
OPTIONS = "^\\s*\\*\\s(.*)"
@for_app('aws')
def match(command):
return "usage:" in command.output and "maybe you meant:" in command.output
def get_new_command(command):
mistak... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/workon_doesnt_exists.py | thefuck/rules/workon_doesnt_exists.py | from thefuck.utils import for_app, replace_command, eager, memoize
from thefuck.system import Path
@memoize
@eager
def _get_all_environments():
root = Path('~/.virtualenvs').expanduser()
if not root.is_dir():
return
for child in root.iterdir():
if child.is_dir():
yield child.n... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/ssh_known_hosts.py | thefuck/rules/ssh_known_hosts.py | import re
from thefuck.utils import for_app
commands = ('ssh', 'scp')
@for_app(*commands)
def match(command):
if not command.script:
return False
if not command.script.startswith(commands):
return False
patterns = (
r'WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!',
r'W... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/mercurial.py | thefuck/rules/mercurial.py | import re
from thefuck.utils import get_closest, for_app
def extract_possibilities(command):
possib = re.findall(r'\n\(did you mean one of ([^\?]+)\?\)', command.output)
if possib:
return possib[0].split(', ')
possib = re.findall(r'\n ([^$]+)$', command.output)
if possib:
return pos... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/conda_mistype.py | thefuck/rules/conda_mistype.py | import re
from thefuck.utils import replace_command, for_app
@for_app("conda")
def match(command):
"""
Match a mistyped command
"""
return "Did you mean 'conda" in command.output
def get_new_command(command):
match = re.findall(r"'conda ([^']*)'", command.output)
broken_cmd = match[0]
co... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/port_already_in_use.py | thefuck/rules/port_already_in_use.py | import re
from subprocess import Popen, PIPE
from thefuck.utils import memoize, which
from thefuck.shells import shell
enabled_by_default = bool(which('lsof'))
patterns = [r"bind on address \('.*', (?P<port>\d+)\)",
r'Unable to bind [^ ]*:(?P<port>\d+)',
r"can't listen on port (?P<port>\d+)",
... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/yarn_alias.py | thefuck/rules/yarn_alias.py | import re
from thefuck.utils import replace_argument, for_app
@for_app('yarn', at_least=1)
def match(command):
return 'Did you mean' in command.output
def get_new_command(command):
broken = command.script_parts[1]
fix = re.findall(r'Did you mean [`"](?:yarn )?([^`"]*)[`"]', command.output)[0]
retur... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_merge_unrelated.py | thefuck/rules/git_merge_unrelated.py | from thefuck.specific.git import git_support
@git_support
def match(command):
return ('merge' in command.script
and 'fatal: refusing to merge unrelated histories' in command.output)
@git_support
def get_new_command(command):
return command.script + ' --allow-unrelated-histories'
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/ls_all.py | thefuck/rules/ls_all.py | from thefuck.utils import for_app
@for_app('ls')
def match(command):
return command.output.strip() == ''
def get_new_command(command):
return ' '.join(['ls', '-A'] + command.script_parts[1:])
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/prove_recursively.py | thefuck/rules/prove_recursively.py | import os
from thefuck.utils import for_app
def _is_recursive(part):
if part == '--recurse':
return True
elif not part.startswith('--') and part.startswith('-') and 'r' in part:
return True
def _isdir(part):
return not part.startswith('-') and os.path.isdir(part)
@for_app('prove')
def ... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/ifconfig_device_not_found.py | thefuck/rules/ifconfig_device_not_found.py | import subprocess
from thefuck.utils import for_app, replace_command, eager
@for_app('ifconfig')
def match(command):
return 'error fetching interface information: Device not found' \
in command.output
@eager
def _get_possible_interfaces():
proc = subprocess.Popen(['ifconfig', '-a'], stdout=subpro... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/brew_update_formula.py | thefuck/rules/brew_update_formula.py | from thefuck.utils import for_app
@for_app('brew', at_least=2)
def match(command):
return ('update' in command.script
and "Error: This command updates brew itself" in command.output
and "Use `brew upgrade" in command.output)
def get_new_command(command):
return command.script.replace... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/npm_wrong_command.py | thefuck/rules/npm_wrong_command.py | from thefuck.specific.npm import npm_available
from thefuck.utils import replace_argument, for_app, eager, get_closest
from thefuck.specific.sudo import sudo_support
enabled_by_default = npm_available
def _get_wrong_command(script_parts):
commands = [part for part in script_parts[1:] if not part.startswith('-')]... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_tag_force.py | thefuck/rules/git_tag_force.py | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('tag' in command.script_parts
and 'already exists' in command.output)
@git_support
def get_new_command(command):
return replace_argument(command.script, 'tag', 'tag --... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/open.py | thefuck/rules/open.py | # Opens URL's in the default web browser
#
# Example:
# > open github.com
# The file ~/github.com does not exist.
# Perhaps you meant 'http://github.com'?
#
from thefuck.shells import shell
from thefuck.utils import eager, for_app
def is_arg_url(command):
return ('.com' in command.script or
'.edu' in ... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/javac.py | thefuck/rules/javac.py | """Appends .java when compiling java files
Example:
> javac foo
error: Class names, 'foo', are only accepted if annotation
processing is explicitly requested
"""
from thefuck.utils import for_app
@for_app('javac')
def match(command):
return not command.script.endswith('.java')
def get_new_command(command):... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/brew_unknown_command.py | thefuck/rules/brew_unknown_command.py | import os
import re
from thefuck.utils import get_closest, replace_command
from thefuck.specific.brew import get_brew_path_prefix, brew_available
BREW_CMD_PATH = '/Homebrew/Library/Homebrew/cmd'
TAP_PATH = '/Homebrew/Library/Taps'
TAP_CMD_PATH = '/%s/%s/cmd'
enabled_by_default = brew_available
def _get_brew_command... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/mvn_unknown_lifecycle_phase.py | thefuck/rules/mvn_unknown_lifecycle_phase.py | from thefuck.utils import for_app, get_close_matches, replace_command
import re
def _get_failed_lifecycle(command):
return re.search(r'\[ERROR\] Unknown lifecycle phase "(.+)"',
command.output)
def _getavailable_lifecycles(command):
return re.search(
r'Available lifecycle phases... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/test.py.py | thefuck/rules/test.py.py | def match(command):
return command.script == 'test.py' and 'not found' in command.output
def get_new_command(command):
return 'pytest'
# make it come before the python_command rule
priority = 900
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/quotation_marks.py | thefuck/rules/quotation_marks.py | # Fixes careless " and ' usage
#
# Example:
# > git commit -m 'My Message"
def match(command):
return '\'' in command.script and '\"' in command.script
def get_new_command(command):
return command.script.replace('\'', '\"')
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/fab_command_not_found.py | thefuck/rules/fab_command_not_found.py | from thefuck.utils import eager, get_closest, for_app
@for_app('fab')
def match(command):
return 'Warning: Command(s) not found:' in command.output
# We need different behavior then in get_all_matched_commands.
@eager
def _get_between(content, start, end=None):
should_yield = False
for line in content.s... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/omnienv_no_such_command.py | thefuck/rules/omnienv_no_such_command.py | import re
from thefuck.utils import (cache, for_app, replace_argument, replace_command,
which)
from subprocess import PIPE, Popen
supported_apps = 'goenv', 'nodenv', 'pyenv', 'rbenv'
enabled_by_default = any(which(a) for a in supported_apps)
COMMON_TYPOS = {
'list': ['versions', 'inst... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_bisect_usage.py | thefuck/rules/git_bisect_usage.py | import re
from thefuck.utils import replace_command
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('bisect' in command.script_parts and
'usage: git bisect' in command.output)
@git_support
def get_new_command(command):
broken = re.findall(r'git bisect ([^ $]... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/django_south_merge.py | thefuck/rules/django_south_merge.py | def match(command):
return 'manage.py' in command.script and \
'migrate' in command.script \
and '--merge: will just attempt the migration' in command.output
def get_new_command(command):
return u'{} --merge'.format(command.script)
| python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_push.py | thefuck/rules/git_push.py | import re
from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('push' in command.script_parts
and 'git push --set-upstream' in command.output)
def _get_upstream_option_index(command_parts):
if '--set-upstream' in command... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/composer_not_command.py | thefuck/rules/composer_not_command.py | import re
from thefuck.utils import replace_argument, for_app
@for_app('composer')
def match(command):
return (('did you mean this?' in command.output.lower()
or 'did you mean one of these?' in command.output.lower())) or (
"install" in command.script_parts and "composer require" in command.o... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/python_execute.py | thefuck/rules/python_execute.py | # Appends .py when executing python files
#
# Example:
# > python foo
# error: python: can't open file 'foo': [Errno 2] No such file or directory
from thefuck.utils import for_app
@for_app('python')
def match(command):
return not command.script.endswith('.py')
def get_new_command(command):
return command.sc... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/sudo.py | thefuck/rules/sudo.py | patterns = ['permission denied',
'eacces',
'pkg: insufficient privileges',
'you cannot perform this operation unless you are root',
'non-root users cannot',
'operation not permitted',
'not super-user',
'superuser privilege',
... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/apt_upgrade.py | thefuck/rules/apt_upgrade.py | from thefuck.specific.apt import apt_available
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app
enabled_by_default = apt_available
@sudo_support
@for_app('apt')
def match(command):
return command.script == "apt list --upgradable" and len(command.output.strip().split('\n')) > 1
@... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/dirty_untar.py | thefuck/rules/dirty_untar.py | import tarfile
import os
from thefuck.utils import for_app
from thefuck.shells import shell
tar_extensions = ('.tar', '.tar.Z', '.tar.bz2', '.tar.gz', '.tar.lz',
'.tar.lzma', '.tar.xz', '.taz', '.tb2', '.tbz', '.tbz2',
'.tgz', '.tlz', '.txz', '.tz')
def _is_tar_extract(cmd):
... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
nvbn/thefuck | https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_diff_staged.py | thefuck/rules/git_diff_staged.py | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('diff' in command.script and
'--staged' not in command.script)
@git_support
def get_new_command(command):
return replace_argument(command.script, 'diff', 'diff --stage... | python | MIT | c7e7e1d884d3bb241ea6448f72a989434c2a35ec | 2026-01-04T14:38:15.457096Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.