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/tests/rules/test_long_form_help.py
tests/rules/test_long_form_help.py
import pytest from thefuck.rules.long_form_help import match, get_new_command from thefuck.types import Command @pytest.mark.parametrize('output', [ 'Try \'grep --help\' for more information.']) def test_match(output): assert match(Command('grep -h', output)) def test_not_match(): assert not match(Comma...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_push_different_branch_names.py
tests/rules/test_git_push_different_branch_names.py
import pytest from thefuck.rules.git_push_different_branch_names import get_new_command, match from thefuck.types import Command output = """fatal: The upstream branch of your current branch does not match the name of your current branch. To push to the upstream branch on the remote, use git push origin HEAD:%s...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/__init__.py
tests/rules/__init__.py
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_branch_delete.py
tests/rules/test_git_branch_delete.py
import pytest from thefuck.rules.git_branch_delete import match, get_new_command from thefuck.types import Command @pytest.fixture def output(): return '''error: The branch 'branch' is not fully merged. If you are sure you want to delete it, run 'git branch -D branch'. ''' def test_match(output): assert ma...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_cat_dir.py
tests/rules/test_cat_dir.py
import pytest from thefuck.rules.cat_dir import match, get_new_command from thefuck.types import Command @pytest.fixture def isdir(mocker): return mocker.patch('thefuck.rules.cat_dir' '.os.path.isdir') @pytest.mark.parametrize('command', [ Command('cat foo', 'cat: foo: Is a directory...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_vagrant_up.py
tests/rules/test_vagrant_up.py
import pytest from thefuck.rules.vagrant_up import match, get_new_command from thefuck.types import Command @pytest.mark.parametrize('command', [ Command('vagrant ssh', 'VM must be running to open SSH connection. Run `vagrant up`\nto start the virtual machine.'), Command('vagrant ssh devbox', 'VM must be runn...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_commit_amend.py
tests/rules/test_git_commit_amend.py
import pytest from thefuck.rules.git_commit_amend import match, get_new_command from thefuck.types import Command @pytest.mark.parametrize('script, output', [ ('git commit -m "test"', 'test output'), ('git commit', '')]) def test_match(output, script): assert match(Command(script, output)) @pytest.mark....
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_chmod_x.py
tests/rules/test_chmod_x.py
import pytest from thefuck.types import Command from thefuck.rules.chmod_x import match, get_new_command @pytest.fixture def file_exists(mocker): return mocker.patch('os.path.exists', return_value=True) @pytest.fixture def file_access(mocker): return mocker.patch('os.access', return_value=False) @pytest.m...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_yarn_command_replaced.py
tests/rules/test_yarn_command_replaced.py
import pytest from thefuck.types import Command from thefuck.rules.yarn_command_replaced import match, get_new_command output = ('error `install` has been replaced with `add` to add new ' 'dependencies. Run "yarn add {}" instead.').format @pytest.mark.parametrize('command', [ Command('yarn install red...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_gulp_not_task.py
tests/rules/test_gulp_not_task.py
import pytest from io import BytesIO from thefuck.types import Command from thefuck.rules.gulp_not_task import match, get_new_command def output(task): return '''[00:41:11] Using gulpfile gulpfile.js [00:41:11] Task '{}' is not in your gulpfile [00:41:11] Please check the documentation for proper gulpfile formatt...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_javac.py
tests/rules/test_javac.py
import pytest from thefuck.rules.javac import match, get_new_command from thefuck.types import Command @pytest.mark.parametrize('command', [ Command('javac foo', ''), Command('javac bar', '')]) def test_match(command): assert match(command) @pytest.mark.parametrize('command, new_command', [ (Command...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_python_module_error.py
tests/rules/test_python_module_error.py
import pytest from thefuck.rules.python_module_error import get_new_command, match from thefuck.types import Command @pytest.fixture def module_error_output(filename, module_name): return """Traceback (most recent call last): File "{0}", line 1, in <module> import {1} ModuleNotFoundError: No module named '...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_apt_upgrade.py
tests/rules/test_apt_upgrade.py
import pytest from thefuck.rules.apt_upgrade import get_new_command, match from thefuck.types import Command match_output = ''' Listing... Done heroku/stable 6.15.2-1 amd64 [upgradable from: 6.14.43-1] resolvconf/zesty-updates,zesty-updates 1.79ubuntu4.1 all [upgradable from: 1.79ubuntu4] squashfs-tools/zesty-updates ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_terraform_init.py
tests/rules/test_terraform_init.py
import pytest from thefuck.rules.terraform_init import match, get_new_command from thefuck.types import Command @pytest.mark.parametrize('script, output', [ ('terraform plan', 'Error: Initialization required. ' 'Please see the error message above.'), ('terraform plan', 'This module is n...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_rm_staged.py
tests/rules/test_git_rm_staged.py
import pytest from thefuck.rules.git_rm_staged import match, get_new_command from thefuck.types import Command @pytest.fixture def output(target): return ('error: the following file has changes staged in the index:\n {}\n(use ' '--cached to keep the file, or -f to force removal)').format(target) ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_path_from_history.py
tests/rules/test_path_from_history.py
import pytest from thefuck.rules.path_from_history import match, get_new_command from thefuck.types import Command @pytest.fixture(autouse=True) def history(mocker): return mocker.patch( 'thefuck.rules.path_from_history.get_valid_history_without_current', return_value=['cd /opt/java', 'ls ~/work/p...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_pull_clone.py
tests/rules/test_git_pull_clone.py
import pytest from thefuck.rules.git_pull_clone import match, get_new_command from thefuck.types import Command git_err = ''' fatal: Not a git repository (or any parent up to mount point /home) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). ''' @pytest.mark.parametrize('command', [ C...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_ag_literal.py
tests/rules/test_ag_literal.py
import pytest from thefuck.rules.ag_literal import get_new_command, match from thefuck.types import Command @pytest.fixture def output(): return ('ERR: Bad regex! pcre_compile() failed at position 1: missing )\n' 'If you meant to search for a literal string, run ag with -Q\n') @pytest.mark.parametri...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_pacman_not_found.py
tests/rules/test_pacman_not_found.py
import pytest from mock import patch from thefuck.rules import pacman_not_found from thefuck.rules.pacman_not_found import match, get_new_command from thefuck.types import Command PKGFILE_OUTPUT_LLC = '''extra/llvm 3.6.0-5 /usr/bin/llc extra/llvm35 3.5.2-13/usr/bin/llc''' @pytest.mark.skipif(not getattr(pacman_...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_rails_migrations_pending.py
tests/rules/test_rails_migrations_pending.py
import pytest from thefuck.rules.rails_migrations_pending import match, get_new_command from thefuck.types import Command output_env_development = ''' Migrations are pending. To resolve this issue, run: rails db:migrate RAILS_ENV=development ''' output_env_test = ''' Migrations are pending. To resolve this is...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_branch_exists.py
tests/rules/test_git_branch_exists.py
import pytest from thefuck.rules.git_branch_exists import match, get_new_command from thefuck.types import Command @pytest.fixture def output(src_branch_name): return "fatal: A branch named '{}' already exists.".format(src_branch_name) @pytest.fixture def new_command(branch_name): return [cmd.format(branch_...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_lfs_mistype.py
tests/rules/test_git_lfs_mistype.py
import pytest from thefuck.rules.git_lfs_mistype import match, get_new_command from thefuck.types import Command @pytest.fixture def mistype_response(): return """ Error: unknown command "evn" for "git-lfs" Did you mean this? env ext Run 'git-lfs --help' for usage. """ def test_match(mist...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_wrong_hyphen_before_subcommand.py
tests/rules/test_wrong_hyphen_before_subcommand.py
import pytest from thefuck.rules.wrong_hyphen_before_subcommand import match, get_new_command from thefuck.types import Command @pytest.fixture(autouse=True) def get_all_executables(mocker): mocker.patch( "thefuck.rules.wrong_hyphen_before_subcommand.get_all_executables", return_value=["git", "ap...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_composer_not_command.py
tests/rules/test_composer_not_command.py
import pytest from thefuck.rules.composer_not_command import match, get_new_command from thefuck.types import Command @pytest.fixture def composer_not_command(): # that weird spacing is part of the actual command output return ( '\n' '\n' ' \n' ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_man_no_space.py
tests/rules/test_man_no_space.py
from thefuck.rules.man_no_space import match, get_new_command from thefuck.types import Command def test_match(): assert match(Command('mandiff', 'mandiff: command not found')) assert not match(Command('', '')) def test_get_new_command(): assert get_new_command(Command('mandiff', '')) == 'man diff'
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_diff_staged.py
tests/rules/test_git_diff_staged.py
import pytest from thefuck.rules.git_diff_staged import match, get_new_command from thefuck.types import Command @pytest.mark.parametrize('command', [ Command('git diff foo', ''), Command('git diff', '')]) def test_match(command): assert match(command) @pytest.mark.parametrize('command', [ Command('...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_bisect_usage.py
tests/rules/test_git_bisect_usage.py
import pytest from thefuck.types import Command from thefuck.rules.git_bisect_usage import match, get_new_command @pytest.fixture def output(): return ("usage: git bisect [help|start|bad|good|new|old" "|terms|skip|next|reset|visualize|replay|log|run]") @pytest.mark.parametrize('script', [ 'git b...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_mvn_unknown_lifecycle_phase.py
tests/rules/test_mvn_unknown_lifecycle_phase.py
import pytest from thefuck.rules.mvn_unknown_lifecycle_phase import match, get_new_command from thefuck.types import Command @pytest.mark.parametrize('command', [ Command('mvn cle', '[ERROR] Unknown lifecycle phase "cle". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_cp_omitting_directory.py
tests/rules/test_cp_omitting_directory.py
import pytest from thefuck.rules.cp_omitting_directory import match, get_new_command from thefuck.types import Command @pytest.mark.parametrize('script, output', [ ('cp dir', 'cp: dor: is a directory'), ('cp dir', "cp: omitting directory 'dir'")]) def test_match(script, output): assert match(Command(scrip...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_history.py
tests/rules/test_history.py
import pytest from thefuck.rules.history import match, get_new_command from thefuck.types import Command @pytest.fixture(autouse=True) def history_without_current(mocker): return mocker.patch( 'thefuck.rules.history.get_valid_history_without_current', return_value=['ls cat', 'diff x']) @pytest.m...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_gradle_not_task.py
tests/rules/test_gradle_not_task.py
import pytest from io import BytesIO from thefuck.rules.gradle_no_task import match, get_new_command from thefuck.types import Command gradle_tasks = b''' :tasks ------------------------------------------------------------ All tasks runnable from root project ----------------------------------------------------------...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_branch_0flag.py
tests/rules/test_git_branch_0flag.py
import pytest from thefuck.rules.git_branch_0flag import get_new_command, match from thefuck.types import Command @pytest.fixture def output_branch_exists(): return "fatal: A branch named 'bar' already exists." @pytest.mark.parametrize( "script", [ "git branch 0a", "git branch 0d", ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_stash.py
tests/rules/test_git_stash.py
import pytest from thefuck.rules.git_stash import match, get_new_command from thefuck.types import Command cherry_pick_error = ( 'error: Your local changes would be overwritten by cherry-pick.\n' 'hint: Commit your changes or stash them to proceed.\n' 'fatal: cherry-pick failed') rebase_error = ( 'C...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_tsuru_not_command.py
tests/rules/test_tsuru_not_command.py
import pytest from thefuck.types import Command from thefuck.rules.tsuru_not_command import match, get_new_command @pytest.mark.parametrize('command', [ Command('tsuru log', ( 'tsuru: "tchururu" is not a tsuru command. See "tsuru help".\n' '\nDid you mean?\n' '\tapp-log\n' '\tlogi...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_grep_recursive.py
tests/rules/test_grep_recursive.py
# -*- coding: utf-8 -*- from thefuck.rules.grep_recursive import match, get_new_command from thefuck.types import Command def test_match(): assert match(Command('grep blah .', 'grep: .: Is a directory')) assert match(Command(u'grep café .', 'grep: .: Is a directory')) assert not match(Command('', '')) ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_merge.py
tests/rules/test_git_merge.py
import pytest from thefuck.rules.git_merge import match, get_new_command from thefuck.types import Command output = 'merge: local - not something we can merge\n\n' \ 'Did you mean this?\n\tremote/local' def test_match(): assert match(Command('git merge test', output)) assert not match(Command('git ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_remote_seturl_add.py
tests/rules/test_git_remote_seturl_add.py
import pytest from thefuck.rules.git_remote_seturl_add import match, get_new_command from thefuck.types import Command @pytest.mark.parametrize('command', [ Command('git remote set-url origin url', "fatal: No such remote")]) def test_match(command): assert match(command) @pytest.mark.parametrize('command', ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_apt_get.py
tests/rules/test_apt_get.py
import pytest from thefuck.rules.apt_get import match, get_new_command from thefuck.types import Command @pytest.mark.parametrize('command, packages', [ (Command('vim', 'vim: command not found'), [('vim', 'main'), ('vim-tiny', 'main')]), (Command('sudo vim', 'vim: command not found'), [('vim', 'main...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_fix_alt_space.py
tests/rules/test_fix_alt_space.py
# -*- encoding: utf-8 -*- from thefuck.rules.fix_alt_space import match, get_new_command from thefuck.types import Command def test_match(): """The character before 'grep' is Alt+Space, which happens frequently on the Mac when typing the pipe character (Alt+7), and holding the Alt key pressed for longer ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_php_s.py
tests/rules/test_php_s.py
import pytest from thefuck.rules.php_s import get_new_command, match from thefuck.types import Command @pytest.mark.parametrize('command', [ Command('php -s localhost:8000', ''), Command('php -t pub -s 0.0.0.0:8080', '') ]) def test_match(command): assert match(command) @pytest.mark.parametrize('command...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_cd_mkdir.py
tests/rules/test_cd_mkdir.py
import pytest from thefuck.rules.cd_mkdir import match, get_new_command from thefuck.types import Command @pytest.mark.parametrize('command', [ Command('cd foo', 'cd: foo: No such file or directory'), Command('cd foo/bar/baz', 'cd: foo: No such file or directory'), Command('cd foo/bar/baz', 'c...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_ln_no_hard_link.py
tests/rules/test_ln_no_hard_link.py
# -*- coding: utf-8 -*- import pytest from thefuck.rules.ln_no_hard_link import match, get_new_command from thefuck.types import Command error = "hard link not allowed for directory" @pytest.mark.parametrize('script, output', [ ("ln barDir barLink", "ln: ‘barDir’: {}"), ("sudo ln a b", "ln: ‘a’: {}"), ("...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_npm_missing_script.py
tests/rules/test_npm_missing_script.py
import pytest from io import BytesIO from thefuck.types import Command from thefuck.rules.npm_missing_script import match, get_new_command output = ''' npm ERR! Linux 4.4.0-31-generic npm ERR! argv "/opt/node/bin/node" "/opt/node/bin/npm" "run" "dvelop" npm ERR! node v4.4.7 npm ERR! npm v2.15.8 npm ERR! missing scri...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_unsudo.py
tests/rules/test_unsudo.py
import pytest from thefuck.rules.unsudo import match, get_new_command from thefuck.types import Command @pytest.mark.parametrize('output', [ 'you cannot perform this operation as root']) def test_match(output): assert match(Command('sudo ls', output)) def test_not_match(): assert not match(Command('', '...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_yum_invalid_operation.py
tests/rules/test_yum_invalid_operation.py
from io import BytesIO import pytest from thefuck.rules.yum_invalid_operation import match, get_new_command, _get_operations from thefuck.types import Command yum_help_text = '''Loaded plugins: extras_suggestions, langpacks, priorities, update-motd Usage: yum [options] COMMAND List of Commands: check Chec...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_yarn_alias.py
tests/rules/test_yarn_alias.py
import pytest from thefuck.rules.yarn_alias import match, get_new_command from thefuck.types import Command output_remove = 'error Did you mean `yarn remove`?' output_etl = 'error Command "etil" not found. Did you mean "etl"?' output_list = 'error Did you mean `yarn list`?' @pytest.mark.parametrize('command', [ ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_cd_cs.py
tests/rules/test_cd_cs.py
from thefuck.rules.cd_cs import match, get_new_command from thefuck.types import Command def test_match(): assert match(Command('cs', 'cs: command not found')) assert match(Command('cs /etc/', 'cs: command not found')) def test_get_new_command(): assert get_new_command(Command('cs /etc/', 'cs: command n...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_django_south_merge.py
tests/rules/test_django_south_merge.py
import pytest from thefuck.rules.django_south_merge import match, get_new_command from thefuck.types import Command @pytest.fixture def output(): return '''Running migrations for app: ! Migration app:0003_auto... should not have been applied before app:0002_auto__add_field_query_due_date_ but was. Traceback (mos...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_git_branch_delete_checked_out.py
tests/rules/test_git_branch_delete_checked_out.py
import pytest from thefuck.rules.git_branch_delete_checked_out import match, get_new_command from thefuck.types import Command @pytest.fixture def output(): return "error: Cannot delete branch 'foo' checked out at '/bar/foo'" @pytest.mark.parametrize("script", ["git branch -d foo", "git branch -D foo"]) def tes...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/rules/test_open.py
tests/rules/test_open.py
import pytest from thefuck.rules.open import is_arg_url, match, get_new_command from thefuck.types import Command @pytest.fixture def output(script): return 'The file {} does not exist.\n'.format(script.split(' ', 1)[1]) @pytest.mark.parametrize('script', [ 'open foo.com', 'open foo.edu', 'open foo....
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/specific/test_npm.py
tests/specific/test_npm.py
from io import BytesIO import pytest from thefuck.specific.npm import get_scripts run_script_stdout = b''' Lifecycle scripts included in code-view-web: test jest available via `npm run-script`: build cp node_modules/ace-builds/src-min/ -a resources/ace/ && webpack --progress --colors -p --config ./webpac...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/specific/test_sudo.py
tests/specific/test_sudo.py
import pytest from thefuck.specific.sudo import sudo_support from thefuck.types import Command @pytest.mark.parametrize('return_value, command, called, result', [ ('ls -lah', 'sudo ls', 'ls', 'sudo ls -lah'), ('ls -lah', 'ls', 'ls', 'ls -lah'), (['ls -lah'], 'sudo ls', 'ls', ['sudo ls -lah']), (True, ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/specific/test_git.py
tests/specific/test_git.py
import pytest from thefuck.specific.git import git_support from thefuck.types import Command @pytest.mark.parametrize('called, command, output', [ ('git co', 'git checkout', "19:22:36.299340 git.c:282 trace: alias expansion: co => 'checkout'"), ('git com file', 'git commit --verbose file', "19:23:25.47...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/specific/__init__.py
tests/specific/__init__.py
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/output_readers/test_rerun.py
tests/output_readers/test_rerun.py
# -*- encoding: utf-8 -*- import pytest import sys from mock import Mock, patch from psutil import AccessDenied, TimeoutExpired from thefuck.output_readers import rerun class TestRerun(object): def setup_method(self, test_method): self.patcher = patch('thefuck.output_readers.rerun.Process') proc...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/shells/test_tcsh.py
tests/shells/test_tcsh.py
# -*- coding: utf-8 -*- import pytest from thefuck.shells.tcsh import Tcsh @pytest.mark.usefixtures('isfile', 'no_memoize', 'no_cache') class TestTcsh(object): @pytest.fixture def shell(self): return Tcsh() @pytest.fixture(autouse=True) def Popen(self, mocker): mock = mocker.patch('t...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/shells/test_powershell.py
tests/shells/test_powershell.py
# -*- coding: utf-8 -*- import pytest from thefuck.shells import Powershell @pytest.mark.usefixtures('isfile', 'no_memoize', 'no_cache') class TestPowershell(object): @pytest.fixture def shell(self): return Powershell() @pytest.fixture(autouse=True) def Popen(self, mocker): mock = mo...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/shells/test_fish.py
tests/shells/test_fish.py
# -*- coding: utf-8 -*- import pytest from thefuck.const import ARGUMENT_PLACEHOLDER from thefuck.shells import Fish @pytest.mark.usefixtures('isfile', 'no_memoize', 'no_cache') class TestFish(object): @pytest.fixture def shell(self): return Fish() @pytest.fixture(autouse=True) def Popen(sel...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/shells/conftest.py
tests/shells/conftest.py
import pytest @pytest.fixture def builtins_open(mocker): return mocker.patch('six.moves.builtins.open') @pytest.fixture def isfile(mocker): return mocker.patch('os.path.isfile', return_value=True) @pytest.fixture @pytest.mark.usefixtures('isfile') def history_lines(mocker): def aux(lines): moc...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/shells/test_zsh.py
tests/shells/test_zsh.py
# -*- coding: utf-8 -*- import os import pytest from thefuck.shells.zsh import Zsh @pytest.mark.usefixtures('isfile', 'no_memoize', 'no_cache') class TestZsh(object): @pytest.fixture def shell(self): return Zsh() @pytest.fixture(autouse=True) def Popen(self, mocker): mock = mocker.pa...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/shells/__init__.py
tests/shells/__init__.py
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/shells/test_bash.py
tests/shells/test_bash.py
# -*- coding: utf-8 -*- import os import pytest from thefuck.shells import Bash @pytest.mark.usefixtures('isfile', 'no_memoize', 'no_cache') class TestBash(object): @pytest.fixture def shell(self): return Bash() @pytest.fixture(autouse=True) def Popen(self, mocker): mock = mocker.pat...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/shells/test_generic.py
tests/shells/test_generic.py
# -*- coding: utf-8 -*- import pytest from thefuck.shells import Generic class TestGeneric(object): @pytest.fixture def shell(self): return Generic() def test_from_shell(self, shell): assert shell.from_shell('pwd') == 'pwd' def test_to_shell(self, shell): assert shell.to_she...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/functional/test_tcsh.py
tests/functional/test_tcsh.py
import pytest from tests.functional.plots import with_confirmation, without_confirmation, \ refuse_with_confirmation, select_command_with_arrows containers = ((u'thefuck/python3', u'', u'tcsh'), (u'thefuck/python2', u'', u'tcsh')) @pytest.fixture(params=containers) def proc(request, spawnu, TIMEOUT...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/functional/plots.py
tests/functional/plots.py
def _set_confirmation(proc, require): proc.sendline(u'mkdir -p ~/.thefuck') proc.sendline( u'echo "require_confirmation = {}" > ~/.thefuck/settings.py'.format( require)) def with_confirmation(proc, TIMEOUT): """Ensures that command can be fixed when confirmation enabled.""" _set_co...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/functional/test_fish.py
tests/functional/test_fish.py
import pytest from tests.functional.plots import with_confirmation, without_confirmation, \ refuse_with_confirmation, select_command_with_arrows containers = ((u'thefuck/python3', u'', u'fish'), (u'thefuck/python2', u'', u'fish')) @pytest.fixture(params=containers) def proc(request, spawnu, TIMEOUT...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/functional/conftest.py
tests/functional/conftest.py
import pytest from pytest_docker_pexpect.docker import run as pexpect_docker_run, \ stats as pexpect_docker_stats @pytest.fixture(autouse=True) def build_container_mock(mocker): return mocker.patch('pytest_docker_pexpect.docker.build_container') def run_side_effect(*args, **kwargs): container_id = pexp...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/functional/test_zsh.py
tests/functional/test_zsh.py
import pytest from tests.functional.plots import with_confirmation, without_confirmation, \ refuse_with_confirmation, history_changed, history_not_changed, \ select_command_with_arrows, how_to_configure python_3 = (u'thefuck/python3', u'', u'sh') python_2 = (u'thefuck/python2', u'', u'sh') init_zshrc = u'''...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/functional/__init__.py
tests/functional/__init__.py
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/tests/functional/test_bash.py
tests/functional/test_bash.py
import pytest from tests.functional.plots import with_confirmation, without_confirmation, \ refuse_with_confirmation, history_changed, history_not_changed, \ select_command_with_arrows, how_to_configure python_3 = (u'thefuck/python3', u'', u'sh') python_2 = (u'thefuck/python2', ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/corrector.py
thefuck/corrector.py
import sys from .conf import settings from .types import Rule from .system import Path from . import logs def get_loaded_rules(rules_paths): """Yields all available rules. :type rules_paths: [Path] :rtype: Iterable[Rule] """ for path in rules_paths: if path.name != '__init__.py': ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/exceptions.py
thefuck/exceptions.py
class EmptyCommand(Exception): """Raised when empty command passed to `thefuck`.""" class NoRuleMatched(Exception): """Raised when no rule matched for some command.""" class ScriptNotInLog(Exception): """Script not found in log."""
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/argument_parser.py
thefuck/argument_parser.py
import sys from argparse import ArgumentParser, SUPPRESS from .const import ARGUMENT_PLACEHOLDER from .utils import get_alias class Parser(object): """Argument parser that can handle arguments with our special placeholder. """ def __init__(self): self._parser = ArgumentParser(prog='thefuck',...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/const.py
thefuck/const.py
# -*- encoding: utf-8 -*- class _GenConst(object): def __init__(self, name): self._name = name def __repr__(self): return u'<const: {}>'.format(self._name) KEY_UP = _GenConst('↑') KEY_DOWN = _GenConst('↓') KEY_CTRL_C = _GenConst('Ctrl+C') KEY_CTRL_N = _GenConst('Ctrl+N') KEY_CTRL_P = _GenCo...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/ui.py
thefuck/ui.py
# -*- encoding: utf-8 -*- import sys from .conf import settings from .exceptions import NoRuleMatched from .system import get_key from .utils import get_alias from . import logs, const def read_actions(): """Yields actions for pressed keys.""" while True: key = get_key() # Handle arrows, j/k...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/utils.py
thefuck/utils.py
import atexit import os import pickle import re import shelve import sys import six from decorator import decorator from difflib import get_close_matches as difflib_get_close_matches from functools import wraps from .logs import warn, exception from .conf import settings from .system import Path DEVNULL = open(os.devn...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/__init__.py
thefuck/__init__.py
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/types.py
thefuck/types.py
import os import sys from . import logs from .shells import shell from .conf import settings, load_source from .const import DEFAULT_PRIORITY, ALL_ENABLED from .exceptions import EmptyCommand from .utils import get_alias, format_raw_script from .output_readers import get_output class Command(object): """Command t...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/conf.py
thefuck/conf.py
import os import sys from warnings import warn from six import text_type from . import const from .system import Path try: import importlib.util def load_source(name, pathname, _file=None): module_spec = importlib.util.spec_from_file_location(name, pathname) module = importlib.util.module_from...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/logs.py
thefuck/logs.py
# -*- encoding: utf-8 -*- from contextlib import contextmanager from datetime import datetime import sys from traceback import format_exception import colorama from .conf import settings from . import const def color(color_): """Utility for ability to disabling colored output.""" if settings.no_colors: ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/system/__init__.py
thefuck/system/__init__.py
import sys if sys.platform == 'win32': from .win32 import * # noqa: F401,F403 else: from .unix import * # noqa: F401,F403
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/system/win32.py
thefuck/system/win32.py
import os import msvcrt import win_unicode_console from .. import const def init_output(): import colorama win_unicode_console.enable() colorama.init() def get_key(): ch = msvcrt.getwch() if ch in ('\x00', '\xe0'): # arrow or function key prefix? ch = msvcrt.getwch() # second call retu...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/system/unix.py
thefuck/system/unix.py
import os import sys import tty import termios import colorama from distutils.spawn import find_executable from .. import const init_output = colorama.init def getch(): fd = sys.stdin.fileno() old = termios.tcgetattr(fd) try: tty.setraw(fd) return sys.stdin.read(1) finally: te...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/entrypoints/shell_logger.py
thefuck/entrypoints/shell_logger.py
import array import fcntl from functools import partial import mmap import os import pty import signal import sys import termios import tty from .. import logs, const def _read(f, fd): data = os.read(fd, 1024) try: f.write(data) except ValueError: position = const.LOG_SIZE_IN_BYTES - const...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/entrypoints/alias.py
thefuck/entrypoints/alias.py
import six from ..conf import settings from ..logs import warn from ..shells import shell from ..utils import which def _get_alias(known_args): if six.PY2: warn("The Fuck will drop Python 2 support soon, more details " "https://github.com/nvbn/thefuck/issues/685") alias = shell.app_alias...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/entrypoints/fix_command.py
thefuck/entrypoints/fix_command.py
from pprint import pformat import os import sys from difflib import SequenceMatcher from .. import logs, types, const from ..conf import settings from ..corrector import get_corrected_commands from ..exceptions import EmptyCommand from ..ui import select_command from ..utils import get_alias, get_all_executables def ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/entrypoints/main.py
thefuck/entrypoints/main.py
# Initialize output before importing any module, that can use colorama. from ..system import init_output init_output() import os # noqa: E402 import sys # noqa: E402 from .. import logs # noqa: E402 from ..argument_parser import Parser # noqa: E402 from ..utils import get_installation_version # noqa: E402 from ....
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/entrypoints/__init__.py
thefuck/entrypoints/__init__.py
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/entrypoints/not_configured.py
thefuck/entrypoints/not_configured.py
# Initialize output before importing any module, that can use colorama. from ..system import init_output init_output() import getpass # noqa: E402 import os # noqa: E402 import json # noqa: E402 from tempfile import gettempdir # noqa: E402 import time # noqa: E402 import six # noqa: E402 from psutil import Proc...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_commit_reset.py
thefuck/rules/git_commit_reset.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 reset HEAD~'
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/docker_image_being_used_by_container.py
thefuck/rules/docker_image_being_used_by_container.py
from thefuck.utils import for_app from thefuck.shells import shell @for_app('docker') def match(command): ''' Matches a command's output with docker's output warning you that you need to remove a container before removing an image. ''' return 'image is being used by running container' in command.o...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/cd_cs.py
thefuck/rules/cd_cs.py
# -*- encoding: utf-8 -*- # Redirects cs to cd when there is a typo # Due to the proximity of the keys - d and s - this seems like a common typo # ~ > cs /etc/ # cs: command not found # ~ > fuck # cd /etc/ [enter/↑/↓/ctrl+c] # /etc > def match(command): if command.script_parts[0] == 'cs': return True d...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/cargo.py
thefuck/rules/cargo.py
def match(command): return command.script == 'cargo' def get_new_command(command): return 'cargo build'
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/cargo_no_command.py
thefuck/rules/cargo_no_command.py
import re from thefuck.utils import replace_argument, for_app @for_app('cargo', at_least=1) def match(command): return ('no such subcommand' in command.output.lower() and 'Did you mean' in command.output) def get_new_command(command): broken = command.script_parts[1] fix = re.findall(r'Did y...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/cd_mkdir.py
thefuck/rules/cd_mkdir.py
import re from thefuck.utils import for_app from thefuck.specific.sudo import sudo_support from thefuck.shells import shell @sudo_support @for_app('cd') def match(command): return ( command.script.startswith('cd ') and any(( 'no such file or directory' in command.output.lower(), 'c...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_pull_uncommitted_changes.py
thefuck/rules/git_pull_uncommitted_changes.py
from thefuck.shells import shell from thefuck.specific.git import git_support @git_support def match(command): return ('pull' in command.script and ('You have unstaged changes' in command.output or 'contains uncommitted changes' in command.output)) @git_support def get_new_command(c...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_push_pull.py
thefuck/rules/git_push_pull.py
from thefuck.shells import shell 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 ...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/git_hook_bypass.py
thefuck/rules/git_hook_bypass.py
from thefuck.utils import replace_argument from thefuck.specific.git import git_support hooked_commands = ("am", "commit", "push") @git_support def match(command): return any( hooked_command in command.script_parts for hooked_command in hooked_commands ) @git_support 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/tsuru_not_command.py
thefuck/rules/tsuru_not_command.py
import re from thefuck.utils import get_all_matched_commands, replace_command, for_app @for_app('tsuru') def match(command): return (' is not a tsuru command. See "tsuru help".' in command.output and '\nDid you mean?\n\t' in command.output) def get_new_command(command): broken_cmd = re.findall(r...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false
nvbn/thefuck
https://github.com/nvbn/thefuck/blob/c7e7e1d884d3bb241ea6448f72a989434c2a35ec/thefuck/rules/go_run.py
thefuck/rules/go_run.py
from thefuck.utils import for_app # Appends .go when compiling go files # # Example: # > go run foo # error: go run: no go files listed @for_app('go') def match(command): return (command.script.startswith('go run ') and not command.script.endswith('.go')) def get_new_command(command): return com...
python
MIT
c7e7e1d884d3bb241ea6448f72a989434c2a35ec
2026-01-04T14:38:15.457096Z
false