nvbn / thefuck

Magnificent app which corrects your previous console command.
MIT License
85.41k stars 3.43k forks source link

IndexError when using thefuck with brew install command #1299

Closed ladyadalovelace closed 2 years ago

ladyadalovelace commented 2 years ago

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

The Fuck 3.32 using Python 3.10.4 and ZSH 5.8.1

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

macOS 12.4

How to reproduce the bug:

1.  type in brew install ______ (insert program here that is not a valid formula or cask)
2. Trigger thefuck using your favorite alias
3.  Warning appears, text below:
    [WARN] Rule brew_install:
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/types.py", line 181, in is_match
    if self.match(command):
  File "/opt/homebrew/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/rules/brew_install.py", line 31, in match
    formula = re.findall(r'Error: No available formula for ([a-z]+)',
IndexError: list index out of range
----------------------------

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

    DEBUG: Run with settings: {'alter_history': True,
 'debug': True,
 'env': {'GIT_TRACE': '1', 'LANG': 'C', 'LC_ALL': 'C'},
 'exclude_rules': [],
 'excluded_search_path_prefixes': [],
 'history_limit': None,
 'instant_mode': False,
 'no_colors': False,
 'num_close_matches': 3,
 'priority': {},
 'repeat': False,
 'require_confirmation': True,
 'rules': [<const: All rules enabled>],
 'slow_commands': ['lein', 'react-native', 'gradle', './gradlew', 'vagrant'],
 'user_dir': PosixPath('/Users/username/.config/thefuck'),
 'wait_command': 3,
 'wait_slow_command': 15}
DEBUG: Received output: Warning: No available formula with the name "vs-code".
Error: No similarly named formulae found.
==> Searching for similarly named formulae...
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

DEBUG: Call: brew install vs-code; with env: {'TERM_SESSION_ID': 'w0t0p0:67B78AAC-50B2-4C5B-A744-6FD9F3733C4E', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.Eefl81qqDp/Listeners', 'LC_TERMINAL_VERSION': '3.4.15', 'COLORFGBG': '15;0', 'ITERM_PROFILE': 'Default', 'XPC_FLAGS': '0x0', 'LANG': 'C', 'PWD': '/Users/username', 'SHELL': '/bin/zsh', '__CFBundleIdentifier': 'com.googlecode.iterm2', 'SECURITYSESSIONID': '186ad', 'TERM_PROGRAM_VERSION': '3.4.15', 'TERM_PROGRAM': 'iTerm.app', 'PATH': '/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin', 'LC_TERMINAL': 'iTerm2', 'COLORTERM': 'truecolor', 'COMMAND_MODE': 'unix2003', 'TERM': 'xterm-256color', 'HOME': '/Users/username', 'TMPDIR': '/var/folders/m8/b4gbyd115jq2k438cv0dxxbw0000gn/T/', 'USER': 'username', 'XPC_SERVICE_NAME': '0', 'LOGNAME': 'username', 'LaunchInstanceID': '569101DB-C0FF-4A34-97AD-BA371DBE6A42', '__CF_USER_TEXT_ENCODING': '0x1F5:0x0:0x0', 'ITERM_SESSION_ID': 'w0t0p0:67B78AAC-50B2-4C5B-A744-6FD9F3733C4E', 'SHLVL': '1', 'OLDPWD': '/Users/username', 'HOMEBREW_PREFIX': '/opt/homebrew', 'HOMEBREW_CELLAR': '/opt/homebrew/Cellar', 'HOMEBREW_REPOSITORY': '/opt/homebrew', 'MANPATH': '/opt/homebrew/share/man::', 'INFOPATH': '/opt/homebrew/share/info:', 'ZSH': '/Users/username/.oh-my-zsh', 'PAGER': 'less', 'LESS': '-R', 'LSCOLORS': 'Gxfxcxdxbxegedabagacad', 'P9K_SSH': '0', 'P9K_TTY': 'old', '_P9K_TTY': '/dev/ttys000', 'TF_SHELL': 'zsh', 'TF_ALIAS': 'fuck', 'TF_SHELL_ALIASES': '-=\'cd -\'\n...=../..\n....=../../..\n.....=../../../..\n......=../../../../..\n1=\'cd -1\'\n2=\'cd -2\'\n3=\'cd -3\'\n4=\'cd -4\'\n5=\'cd -5\'\n6=\'cd -6\'\n7=\'cd -7\'\n8=\'cd -8\'\n9=\'cd -9\'\n_=\'sudo \'\nafind=\'ack -il\'\negrep=\'egrep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}\'\nfgrep=\'fgrep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}\'\ng=git\nga=\'git add\'\ngaa=\'git add --all\'\ngam=\'git am\'\ngama=\'git am --abort\'\ngamc=\'git am --continue\'\ngams=\'git am --skip\'\ngamscp=\'git am --show-current-patch\'\ngap=\'git apply\'\ngapa=\'git add --patch\'\ngapt=\'git apply --3way\'\ngau=\'git add --update\'\ngav=\'git add --verbose\'\ngb=\'git branch\'\ngbD=\'git branch -D\'\ngba=\'git branch -a\'\ngbd=\'git branch -d\'\ngbda=\'git branch --no-color --merged | command grep -vE "^([+*]|\\s*($(git_main_branch)|$(git_develop_branch))\\s*$)" | command xargs git branch -d 2>/dev/null\'\ngbl=\'git blame -b -w\'\ngbnm=\'git branch --no-merged\'\ngbr=\'git branch --remote\'\ngbs=\'git bisect\'\ngbsb=\'git bisect bad\'\ngbsg=\'git bisect good\'\ngbsr=\'git bisect reset\'\ngbss=\'git bisect start\'\ngc=\'git commit -v\'\n\'gc!\'=\'git commit -v --amend\'\ngca=\'git commit -v -a\'\n\'gca!\'=\'git commit -v -a --amend\'\ngcam=\'git commit -a -m\'\n\'gcan!\'=\'git commit -v -a --no-edit --amend\'\n\'gcans!\'=\'git commit -v -a -s --no-edit --amend\'\ngcas=\'git commit -a -s\'\ngcasm=\'git commit -a -s -m\'\ngcb=\'git checkout -b\'\ngcd=\'git checkout $(git_develop_branch)\'\ngcf=\'git config --list\'\ngcl=\'git clone --recurse-submodules\'\ngclean=\'git clean -id\'\ngcm=\'git checkout $(git_main_branch)\'\ngcmsg=\'git commit -m\'\n\'gcn!\'=\'git commit -v --no-edit --amend\'\ngco=\'git checkout\'\ngcor=\'git checkout --recurse-submodules\'\ngcount=\'git shortlog -sn\'\ngcp=\'git cherry-pick\'\ngcpa=\'git cherry-pick --abort\'\ngcpc=\'git cherry-pick --continue\'\ngcs=\'git commit -S\'\ngcsm=\'git commit -s -m\'\ngcss=\'git commit -S -s\'\ngcssm=\'git commit -S -s -m\'\ngd=\'git diff\'\ngdca=\'git diff --cached\'\ngdct=\'git describe --tags $(git rev-list --tags --max-count=1)\'\ngdcw=\'git diff --cached --word-diff\'\ngds=\'git diff --staged\'\ngdt=\'git diff-tree --no-commit-id --name-only -r\'\ngdup=\'git diff @{upstream}\'\ngdw=\'git diff --word-diff\'\ngf=\'git fetch\'\ngfa=\'git fetch --all --prune --jobs=10\'\ngfg=\'git ls-files | grep\'\ngfo=\'git fetch origin\'\ngg=\'git gui citool\'\ngga=\'git gui citool --amend\'\nggpull=\'git pull origin "$(git_current_branch)"\'\nggpur=ggu\nggpush=\'git push origin "$(git_current_branch)"\'\nggsup=\'git branch --set-upstream-to=origin/$(git_current_branch)\'\nghh=\'git help\'\ngignore=\'git update-index --assume-unchanged\'\ngignored=\'git ls-files -v | grep "^[[:lower:]]"\'\ngit-svn-dcommit-push=\'git svn dcommit && git push github $(git_main_branch):svntrunk\'\ngk=\'\\gitk --all --branches &!\'\ngke=\'\\gitk --all $(git log -g --pretty=%h) &!\'\ngl=\'git pull\'\nglg=\'git log --stat\'\nglgg=\'git log --graph\'\nglgga=\'git log --graph --decorate --all\'\nglgm=\'git log --graph --max-count=10\'\nglgp=\'git log --stat -p\'\nglo=\'git log --oneline --decorate\'\ngloburl=\'noglob urlglobber \'\nglod=\'git log --graph --pretty=\'\\\'\'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\'\\\'\nglods=\'git log --graph --pretty=\'\\\'\'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\'\\\'\' --date=short\'\nglog=\'git log --oneline --decorate --graph\'\ngloga=\'git log --oneline --decorate --graph --all\'\nglol=\'git log --graph --pretty=\'\\\'\'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\'\\\'\nglola=\'git log --graph --pretty=\'\\\'\'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\'\\\'\' --all\'\nglols=\'git log --graph --pretty=\'\\\'\'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\'\\\'\' --stat\'\nglp=_git_log_prettily\nglum=\'git pull upstream $(git_main_branch)\'\ngm=\'git merge\'\ngma=\'git merge --abort\'\ngmom=\'git merge origin/$(git_main_branch)\'\ngmtl=\'git mergetool --no-prompt\'\ngmtlvim=\'git mergetool --no-prompt --tool=vimdiff\'\ngmum=\'git merge upstream/$(git_main_branch)\'\ngp=\'git push\'\ngpd=\'git push --dry-run\'\ngpf=\'git push --force-with-lease\'\n\'gpf!\'=\'git push --force\'\ngpoat=\'git push origin --all && git push origin --tags\'\ngpr=\'git pull --rebase\'\ngpristine=\'git reset --hard && git clean -dffx\'\ngpsup=\'git push --set-upstream origin $(git_current_branch)\'\ngpu=\'git push upstream\'\ngpv=\'git push -v\'\ngr=\'git remote\'\ngra=\'git remote add\'\ngrb=\'git rebase\'\ngrba=\'git rebase --abort\'\ngrbc=\'git rebase --continue\'\ngrbd=\'git rebase $(git_develop_branch)\'\ngrbi=\'git rebase -i\'\ngrbm=\'git rebase $(git_main_branch)\'\ngrbo=\'git rebase --onto\'\ngrbom=\'git rebase origin/$(git_main_branch)\'\ngrbs=\'git rebase --skip\'\ngrep=\'grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}\'\ngrev=\'git revert\'\ngrh=\'git reset\'\ngrhh=\'git reset --hard\'\ngrm=\'git rm\'\ngrmc=\'git rm --cached\'\ngrmv=\'git remote rename\'\ngroh=\'git reset origin/$(git_current_branch) --hard\'\ngrrm=\'git remote remove\'\ngrs=\'git restore\'\ngrset=\'git remote set-url\'\ngrss=\'git restore --source\'\ngrst=\'git restore --staged\'\ngrt=\'cd "$(git rev-parse --show-toplevel || echo .)"\'\ngru=\'git reset --\'\ngrup=\'git remote update\'\ngrv=\'git remote -v\'\ngsb=\'git status -sb\'\ngsd=\'git svn dcommit\'\ngsh=\'git show\'\ngsi=\'git submodule init\'\ngsps=\'git show --pretty=short --show-signature\'\ngsr=\'git svn rebase\'\ngss=\'git status -s\'\ngst=\'git status\'\ngsta=\'git stash push\'\ngstaa=\'git stash apply\'\ngstall=\'git stash --all\'\ngstc=\'git stash clear\'\ngstd=\'git stash drop\'\ngstl=\'git stash list\'\ngstp=\'git stash pop\'\ngsts=\'git stash show --text\'\ngstu=\'gsta --include-untracked\'\ngsu=\'git submodule update\'\ngsw=\'git switch\'\ngswc=\'git switch -c\'\ngswd=\'git switch $(git_develop_branch)\'\ngswm=\'git switch $(git_main_branch)\'\ngtl=\'gtl(){ git tag --sort=-v:refname -n -l "${1}*" }; noglob gtl\'\ngts=\'git tag -s\'\ngtv=\'git tag | sort -V\'\ngunignore=\'git update-index --no-assume-unchanged\'\ngunwip=\'git log -n 1 | grep -q -c "\\-\\-wip\\-\\-" && git reset HEAD~1\'\ngup=\'git pull --rebase\'\ngupa=\'git pull --rebase --autostash\'\ngupav=\'git pull --rebase --autostash -v\'\ngupv=\'git pull --rebase -v\'\ngwch=\'git whatchanged -p --abbrev-commit --pretty=medium\'\ngwip=\'git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"\'\nhidefiles=\'defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder\'\nhistory=omz_history\nl=\'ls -lah\'\nla=\'ls -lAh\'\nll=\'ls -lh\'\nls=\'ls -G\'\nlsa=\'ls -lah\'\nmd=\'mkdir -p\'\nofd=\'open_command $PWD\'\npip=\'noglob pip\'\npipir=\'pip install -r requirements.txt\'\npipreq=\'pip freeze > requirements.txt\'\nrd=rmdir\nrun-help=man\nshowfiles=\'defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder\'\nwhich-command=whence', 'PYTHONIOENCODING': 'utf-8', 'THEFUCK_DEBUG': 'true', 'TF_HISTORY': 'brew install adobe-reader\nfuck\nbrew install adobe-acrobat-dc\nfuck\nthefuck --version\nbrew install vs-code\nfuck\nexport THEFUCK_DEBUG=true\nthefuck\nbrew install vs-code', '_': '/opt/homebrew/bin/thefuck', 'LC_ALL': 'C', 'GIT_TRACE': '1'}; is slow: False took: 0:00:03.026073
DEBUG: Importing rule: adb_unknown_command; took: 0:00:00.000602
DEBUG: Importing rule: ag_literal; took: 0:00:00.000515
DEBUG: Importing rule: apt_get; took: 0:00:00.000996
DEBUG: Importing rule: apt_get_search; took: 0:00:00.000180
DEBUG: Importing rule: apt_invalid_operation; took: 0:00:00.000476
DEBUG: Importing rule: apt_list_upgradable; took: 0:00:00.000156
DEBUG: Importing rule: apt_upgrade; took: 0:00:00.000243
DEBUG: Importing rule: aws_cli; took: 0:00:00.000139
DEBUG: Importing rule: az_cli; took: 0:00:00.000141
DEBUG: Importing rule: brew_cask_dependency; took: 0:00:00.000385
DEBUG: Importing rule: brew_install; took: 0:00:00.000151
DEBUG: Importing rule: brew_link; took: 0:00:00.000140
DEBUG: Importing rule: brew_reinstall; took: 0:00:00.000363
DEBUG: Importing rule: brew_uninstall; took: 0:00:00.000140
DEBUG: Importing rule: brew_unknown_command; took: 0:00:00.000124
DEBUG: Importing rule: brew_update_formula; took: 0:00:00.000126
DEBUG: Importing rule: cargo; took: 0:00:00.000101
DEBUG: Importing rule: cargo_no_command; took: 0:00:00.000124
DEBUG: Importing rule: cat_dir; took: 0:00:00.000122
DEBUG: Importing rule: cd_correction; took: 0:00:00.000826
DEBUG: Importing rule: cd_cs; took: 0:00:00.000256
DEBUG: Importing rule: cd_mkdir; took: 0:00:00.000234
DEBUG: Importing rule: cd_parent; took: 0:00:00.000127
DEBUG: Importing rule: chmod_x; took: 0:00:00.000112
DEBUG: Importing rule: choco_install; took: 0:00:00.000247
DEBUG: Importing rule: composer_not_command; took: 0:00:00.000180
DEBUG: Importing rule: conda_mistype; took: 0:00:00.000158
DEBUG: Importing rule: cp_create_destination; took: 0:00:00.000159
DEBUG: Importing rule: cp_omitting_directory; took: 0:00:00.000172
DEBUG: Importing rule: cpp11; took: 0:00:00.000138
DEBUG: Importing rule: dirty_untar; took: 0:00:00.001097
DEBUG: Importing rule: dirty_unzip; took: 0:00:00.000162
DEBUG: Importing rule: django_south_ghost; took: 0:00:00.000097
DEBUG: Importing rule: django_south_merge; took: 0:00:00.000223
DEBUG: Importing rule: dnf_no_such_command; took: 0:00:00.000418
DEBUG: Importing rule: docker_image_being_used_by_container; took: 0:00:00.000135
DEBUG: Importing rule: docker_login; took: 0:00:00.000133
DEBUG: Importing rule: docker_not_command; took: 0:00:00.000207
DEBUG: Importing rule: dry; took: 0:00:00.000092
DEBUG: Importing rule: fab_command_not_found; took: 0:00:00.000201
DEBUG: Importing rule: fix_alt_space; took: 0:00:00.000156
DEBUG: Importing rule: fix_file; took: 0:00:00.001773
DEBUG: Importing rule: gem_unknown_command; took: 0:00:00.000304
DEBUG: Importing rule: git_add; took: 0:00:00.000275
DEBUG: Importing rule: git_add_force; took: 0:00:00.000117
DEBUG: Importing rule: git_bisect_usage; took: 0:00:00.000115
DEBUG: Importing rule: git_branch_0flag; took: 0:00:00.000243
DEBUG: Importing rule: git_branch_delete; took: 0:00:00.000105
DEBUG: Importing rule: git_branch_delete_checked_out; took: 0:00:00.000117
DEBUG: Importing rule: git_branch_exists; took: 0:00:00.000114
DEBUG: Importing rule: git_branch_list; took: 0:00:00.000107
DEBUG: Importing rule: git_checkout; took: 0:00:00.000121
DEBUG: Importing rule: git_clone_git_clone; took: 0:00:00.000104
DEBUG: Importing rule: git_commit_add; took: 0:00:00.000157
DEBUG: Importing rule: git_commit_amend; took: 0:00:00.000106
DEBUG: Importing rule: git_commit_reset; took: 0:00:00.000104
DEBUG: Importing rule: git_diff_no_index; took: 0:00:00.000103
DEBUG: Importing rule: git_diff_staged; took: 0:00:00.000114
DEBUG: Importing rule: git_fix_stash; took: 0:00:00.000108
DEBUG: Importing rule: git_flag_after_filename; took: 0:00:00.000109
DEBUG: Importing rule: git_help_aliased; took: 0:00:00.000107
DEBUG: Importing rule: git_hook_bypass; took: 0:00:00.000247
DEBUG: Importing rule: git_lfs_mistype; took: 0:00:00.000103
DEBUG: Importing rule: git_main_master; took: 0:00:00.000106
DEBUG: Importing rule: git_merge; took: 0:00:00.000101
DEBUG: Importing rule: git_merge_unrelated; took: 0:00:00.000108
DEBUG: Importing rule: git_not_command; took: 0:00:00.000104
DEBUG: Importing rule: git_pull; took: 0:00:00.000111
DEBUG: Importing rule: git_pull_clone; took: 0:00:00.000130
DEBUG: Importing rule: git_pull_uncommitted_changes; took: 0:00:00.000104
DEBUG: Importing rule: git_push; took: 0:00:00.000155
DEBUG: Importing rule: git_push_different_branch_names; took: 0:00:00.000145
DEBUG: Importing rule: git_push_force; took: 0:00:00.000109
DEBUG: Importing rule: git_push_pull; took: 0:00:00.000101
DEBUG: Importing rule: git_push_without_commits; took: 0:00:00.000089
DEBUG: Importing rule: git_rebase_merge_dir; took: 0:00:00.000104
DEBUG: Importing rule: git_rebase_no_changes; took: 0:00:00.000156
DEBUG: Importing rule: git_remote_delete; took: 0:00:00.000101
DEBUG: Importing rule: git_remote_seturl_add; took: 0:00:00.000088
DEBUG: Importing rule: git_rm_local_modifications; took: 0:00:00.000100
DEBUG: Importing rule: git_rm_recursive; took: 0:00:00.000096
DEBUG: Importing rule: git_rm_staged; took: 0:00:00.000097
DEBUG: Importing rule: git_stash; took: 0:00:00.000101
DEBUG: Importing rule: git_stash_pop; took: 0:00:00.000097
DEBUG: Importing rule: git_tag_force; took: 0:00:00.000103
DEBUG: Importing rule: git_two_dashes; took: 0:00:00.000125
DEBUG: Importing rule: go_run; took: 0:00:00.000100
DEBUG: Importing rule: go_unknown_command; took: 0:00:00.000155
DEBUG: Importing rule: gradle_no_task; took: 0:00:00.000214
DEBUG: Importing rule: gradle_wrapper; took: 0:00:00.000119
DEBUG: Importing rule: grep_arguments_order; took: 0:00:00.000108
DEBUG: Importing rule: grep_recursive; took: 0:00:00.000245
DEBUG: Importing rule: grunt_task_not_found; took: 0:00:00.000252
DEBUG: Importing rule: gulp_not_task; took: 0:00:00.000157
DEBUG: Importing rule: has_exists_script; took: 0:00:00.000111
DEBUG: Importing rule: heroku_multiple_apps; took: 0:00:00.000099
DEBUG: Importing rule: heroku_not_command; took: 0:00:00.000102
DEBUG: Importing rule: history; took: 0:00:00.000073
DEBUG: Importing rule: hostscli; took: 0:00:00.000122
DEBUG: Importing rule: ifconfig_device_not_found; took: 0:00:00.000113
DEBUG: Importing rule: java; took: 0:00:00.000136
DEBUG: Importing rule: javac; took: 0:00:00.000113
DEBUG: Importing rule: lein_not_task; took: 0:00:00.000155
DEBUG: Importing rule: ln_no_hard_link; took: 0:00:00.000148
DEBUG: Importing rule: ln_s_order; took: 0:00:00.000103
DEBUG: Importing rule: long_form_help; took: 0:00:00.000077
DEBUG: Importing rule: ls_all; took: 0:00:00.000205
DEBUG: Importing rule: ls_lah; took: 0:00:00.000095
DEBUG: Importing rule: man; took: 0:00:00.000104
DEBUG: Importing rule: man_no_space; took: 0:00:00.000080
DEBUG: Importing rule: mercurial; took: 0:00:00.000102
DEBUG: Importing rule: missing_space_before_subcommand; took: 0:00:00.000076
DEBUG: Importing rule: mkdir_p; took: 0:00:00.000108
DEBUG: Importing rule: mvn_no_command; took: 0:00:00.000093
DEBUG: Importing rule: mvn_unknown_lifecycle_phase; took: 0:00:00.000114
DEBUG: Importing rule: nixos_cmd_not_found; took: 0:00:00.000297
DEBUG: Importing rule: no_command; took: 0:00:00.000120
DEBUG: Importing rule: no_such_file; took: 0:00:00.000079
DEBUG: Importing rule: npm_missing_script; took: 0:00:00.000293
DEBUG: Importing rule: npm_run_script; took: 0:00:00.000255
DEBUG: Importing rule: npm_wrong_command; took: 0:00:00.000120
DEBUG: Importing rule: omnienv_no_such_command; took: 0:00:00.000236
DEBUG: Importing rule: open; took: 0:00:00.000119
DEBUG: Importing rule: pacman; took: 0:00:00.000284
DEBUG: Importing rule: pacman_invalid_option; took: 0:00:00.000127
DEBUG: Importing rule: pacman_not_found; took: 0:00:00.000088
DEBUG: Importing rule: path_from_history; took: 0:00:00.000101
DEBUG: Importing rule: php_s; took: 0:00:00.000103
DEBUG: Importing rule: pip_install; took: 0:00:00.000110
DEBUG: Importing rule: pip_unknown_command; took: 0:00:00.000105
DEBUG: Importing rule: port_already_in_use; took: 0:00:00.000134
DEBUG: Importing rule: prove_recursively; took: 0:00:00.000203
DEBUG: Importing rule: python_command; took: 0:00:00.000143
DEBUG: Importing rule: python_execute; took: 0:00:00.000190
DEBUG: Importing rule: python_module_error; took: 0:00:00.000075
DEBUG: Importing rule: quotation_marks; took: 0:00:00.000109
DEBUG: Importing rule: rails_migrations_pending; took: 0:00:00.000071
DEBUG: Importing rule: react_native_command_unrecognized; took: 0:00:00.000133
DEBUG: Importing rule: remove_shell_prompt_literal; took: 0:00:00.000082
DEBUG: Importing rule: remove_trailing_cedilla; took: 0:00:00.000072
DEBUG: Importing rule: rm_dir; took: 0:00:00.000095
DEBUG: Importing rule: rm_root; took: 0:00:00.000087
DEBUG: Importing rule: scm_correction; took: 0:00:00.000098
DEBUG: Importing rule: sed_unterminated_s; took: 0:00:00.000100
DEBUG: Importing rule: sl_ls; took: 0:00:00.000075
DEBUG: Importing rule: ssh_known_hosts; took: 0:00:00.000092
DEBUG: Importing rule: sudo; took: 0:00:00.000086
DEBUG: Importing rule: sudo_command_from_user_path; took: 0:00:00.000148
DEBUG: Importing rule: switch_lang; took: 0:00:00.000227
DEBUG: Importing rule: systemctl; took: 0:00:00.000116
DEBUG: Importing rule: terraform_init; took: 0:00:00.000101
DEBUG: Importing rule: test.py; took: 0:00:00.000071
DEBUG: Importing rule: tmux; took: 0:00:00.000099
DEBUG: Importing rule: touch; took: 0:00:00.000101
DEBUG: Importing rule: tsuru_login; took: 0:00:00.000119
DEBUG: Importing rule: tsuru_not_command; took: 0:00:00.000095
DEBUG: Importing rule: unknown_command; took: 0:00:00.000081
DEBUG: Importing rule: unsudo; took: 0:00:00.000079
DEBUG: Importing rule: vagrant_up; took: 0:00:00.000092
DEBUG: Importing rule: whois; took: 0:00:00.000191
DEBUG: Importing rule: workon_doesnt_exists; took: 0:00:00.000120
DEBUG: Importing rule: wrong_hyphen_before_subcommand; took: 0:00:00.000099
DEBUG: Importing rule: yarn_alias; took: 0:00:00.000137
DEBUG: Importing rule: yarn_command_not_found; took: 0:00:00.000267
DEBUG: Importing rule: yarn_command_replaced; took: 0:00:00.000151
DEBUG: Importing rule: yarn_help; took: 0:00:00.000106
DEBUG: Importing rule: yum_invalid_operation; took: 0:00:00.000245
DEBUG: Trying rule: path_from_history; took: 0:00:00.000225
DEBUG: Trying rule: cd_cs; took: 0:00:00.000039
DEBUG: Trying rule: dry; took: 0:00:00.000002
DEBUG: Trying rule: git_stash_pop; took: 0:00:00.000026
DEBUG: Trying rule: test.py; took: 0:00:00.000001
DEBUG: Trying rule: adb_unknown_command; took: 0:00:00.000007
DEBUG: Trying rule: ag_literal; took: 0:00:00.000011
DEBUG: Trying rule: aws_cli; took: 0:00:00.000009
DEBUG: Trying rule: az_cli; took: 0:00:00.000009
DEBUG: Trying rule: brew_cask_dependency; took: 0:00:00.000009
DEBUG: Trying rule: brew_install; took: 0:00:00.000074
[WARN] Rule brew_install:
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/types.py", line 181, in is_match
    if self.match(command):
  File "/opt/homebrew/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/rules/brew_install.py", line 31, in match
    formula = re.findall(r'Error: No available formula for ([a-z]+)',
IndexError: list index out of range
----------------------------

DEBUG: Trying rule: brew_link; took: 0:00:00.000015
DEBUG: Trying rule: brew_reinstall; took: 0:00:00.000015
DEBUG: Trying rule: brew_uninstall; took: 0:00:00.000008
DEBUG: Trying rule: brew_unknown_command; took: 0:00:00.000003
DEBUG: Trying rule: brew_update_formula; took: 0:00:00.000007
DEBUG: Trying rule: cargo; took: 0:00:00.000001
DEBUG: Trying rule: cargo_no_command; took: 0:00:00.000009
DEBUG: Trying rule: cat_dir; took: 0:00:00.000009
DEBUG: Trying rule: cd_correction; took: 0:00:00.000012
DEBUG: Trying rule: cd_mkdir; took: 0:00:00.000011
DEBUG: Trying rule: cd_parent; took: 0:00:00.000001
DEBUG: Trying rule: chmod_x; took: 0:00:00.000001
DEBUG: Trying rule: composer_not_command; took: 0:00:00.000009
DEBUG: Trying rule: conda_mistype; took: 0:00:00.000008
DEBUG: Trying rule: cp_create_destination; took: 0:00:00.000009
DEBUG: Trying rule: cp_omitting_directory; took: 0:00:00.000013
DEBUG: Trying rule: cpp11; took: 0:00:00.000008
DEBUG: Trying rule: dirty_untar; took: 0:00:00.000008
DEBUG: Trying rule: dirty_unzip; took: 0:00:00.000008
DEBUG: Trying rule: django_south_ghost; took: 0:00:00.000001
DEBUG: Trying rule: django_south_merge; took: 0:00:00.000001
DEBUG: Trying rule: docker_image_being_used_by_container; took: 0:00:00.000008
DEBUG: Trying rule: docker_login; took: 0:00:00.000007
DEBUG: Trying rule: docker_not_command; took: 0:00:00.000010
DEBUG: Trying rule: fab_command_not_found; took: 0:00:00.000008
DEBUG: Trying rule: fix_alt_space; took: 0:00:00.000006
DEBUG: Trying rule: fix_file; took: 0:00:00.000003
DEBUG: Trying rule: gem_unknown_command; took: 0:00:00.000009
DEBUG: Trying rule: git_add; took: 0:00:00.000008
DEBUG: Trying rule: git_add_force; took: 0:00:00.000007
DEBUG: Trying rule: git_bisect_usage; took: 0:00:00.000007
DEBUG: Trying rule: git_branch_0flag; took: 0:00:00.000007
DEBUG: Trying rule: git_branch_delete; took: 0:00:00.000007
DEBUG: Trying rule: git_branch_delete_checked_out; took: 0:00:00.000006
DEBUG: Trying rule: git_branch_exists; took: 0:00:00.000007
DEBUG: Trying rule: git_branch_list; took: 0:00:00.000007
DEBUG: Trying rule: git_checkout; took: 0:00:00.000007
DEBUG: Trying rule: git_clone_git_clone; took: 0:00:00.000007
DEBUG: Trying rule: git_commit_add; took: 0:00:00.000006
DEBUG: Trying rule: git_commit_amend; took: 0:00:00.000006
DEBUG: Trying rule: git_commit_reset; took: 0:00:00.000007
DEBUG: Trying rule: git_diff_no_index; took: 0:00:00.000007
DEBUG: Trying rule: git_diff_staged; took: 0:00:00.000007
DEBUG: Trying rule: git_fix_stash; took: 0:00:00.000006
DEBUG: Trying rule: git_flag_after_filename; took: 0:00:00.000006
DEBUG: Trying rule: git_help_aliased; took: 0:00:00.000006
DEBUG: Trying rule: git_lfs_mistype; took: 0:00:00.000006
DEBUG: Trying rule: git_merge; took: 0:00:00.000006
DEBUG: Trying rule: git_merge_unrelated; took: 0:00:00.000006
DEBUG: Trying rule: git_not_command; took: 0:00:00.000007
DEBUG: Trying rule: git_pull; took: 0:00:00.000007
DEBUG: Trying rule: git_pull_clone; took: 0:00:00.000006
DEBUG: Trying rule: git_pull_uncommitted_changes; took: 0:00:00.000007
DEBUG: Trying rule: git_push; took: 0:00:00.000007
DEBUG: Trying rule: git_push_different_branch_names; took: 0:00:00.000006
DEBUG: Trying rule: git_push_pull; took: 0:00:00.000007
DEBUG: Trying rule: git_push_without_commits; took: 0:00:00.000007
DEBUG: Trying rule: git_rebase_merge_dir; took: 0:00:00.000007
DEBUG: Trying rule: git_rebase_no_changes; took: 0:00:00.000007
DEBUG: Trying rule: git_remote_delete; took: 0:00:00.000006
DEBUG: Trying rule: git_remote_seturl_add; took: 0:00:00.000006
DEBUG: Trying rule: git_rm_local_modifications; took: 0:00:00.000006
DEBUG: Trying rule: git_rm_recursive; took: 0:00:00.000006
DEBUG: Trying rule: git_rm_staged; took: 0:00:00.000007
DEBUG: Trying rule: git_stash; took: 0:00:00.000007
DEBUG: Trying rule: git_tag_force; took: 0:00:00.000006
DEBUG: Trying rule: git_two_dashes; took: 0:00:00.000006
DEBUG: Trying rule: go_run; took: 0:00:00.000007
DEBUG: Trying rule: go_unknown_command; took: 0:00:00.000007
DEBUG: Trying rule: gradle_no_task; took: 0:00:00.000008
DEBUG: Trying rule: gradle_wrapper; took: 0:00:00.000008
DEBUG: Trying rule: grep_arguments_order; took: 0:00:00.000008
DEBUG: Trying rule: grep_recursive; took: 0:00:00.000008
DEBUG: Trying rule: grunt_task_not_found; took: 0:00:00.000008
DEBUG: Trying rule: gulp_not_task; took: 0:00:00.000007
DEBUG: Trying rule: has_exists_script; took: 0:00:00.000020
DEBUG: Trying rule: heroku_multiple_apps; took: 0:00:00.000009
DEBUG: Trying rule: heroku_not_command; took: 0:00:00.000007
DEBUG: Trying rule: hostscli; took: 0:00:00.000011
DEBUG: Trying rule: ifconfig_device_not_found; took: 0:00:00.000007
DEBUG: Trying rule: java; took: 0:00:00.000008
DEBUG: Trying rule: javac; took: 0:00:00.000008
DEBUG: Trying rule: lein_not_task; took: 0:00:00.000012
DEBUG: Trying rule: ln_no_hard_link; took: 0:00:00.000004
DEBUG: Trying rule: ln_s_order; took: 0:00:00.000004
DEBUG: Trying rule: ls_all; took: 0:00:00.000007
DEBUG: Trying rule: ls_lah; took: 0:00:00.000006
DEBUG: Trying rule: man; took: 0:00:00.000008
DEBUG: Trying rule: mercurial; took: 0:00:00.000008
DEBUG: Trying rule: mkdir_p; took: 0:00:00.000004
DEBUG: Trying rule: mvn_no_command; took: 0:00:00.000008
DEBUG: Trying rule: mvn_unknown_lifecycle_phase; took: 0:00:00.000007
DEBUG: Trying rule: no_such_file; took: 0:00:00.000298
DEBUG: Trying rule: open; took: 0:00:00.000012
DEBUG: Trying rule: pacman_invalid_option; took: 0:00:00.000013
DEBUG: Trying rule: php_s; took: 0:00:00.000009
DEBUG: Trying rule: pip_install; took: 0:00:00.000011
DEBUG: Trying rule: pip_unknown_command; took: 0:00:00.000012
DEBUG: Trying rule: port_already_in_use; took: 0:00:00.000209
DEBUG: Trying rule: prove_recursively; took: 0:00:00.000012
DEBUG: Trying rule: python_command; took: 0:00:00.000006
DEBUG: Trying rule: python_execute; took: 0:00:00.000008
DEBUG: Trying rule: python_module_error; took: 0:00:00.000001
DEBUG: Trying rule: quotation_marks; took: 0:00:00
DEBUG: Trying rule: rails_migrations_pending; took: 0:00:00
DEBUG: Trying rule: react_native_command_unrecognized; took: 0:00:00.000008
DEBUG: Trying rule: remove_shell_prompt_literal; took: 0:00:00.000001
DEBUG: Trying rule: remove_trailing_cedilla; took: 0:00:00.000001
DEBUG: Trying rule: rm_dir; took: 0:00:00.000005
DEBUG: Trying rule: scm_correction; took: 0:00:00.000007
DEBUG: Trying rule: sed_unterminated_s; took: 0:00:00.000008
DEBUG: Trying rule: sl_ls; took: 0:00:00.000001
DEBUG: Trying rule: ssh_known_hosts; took: 0:00:00.000007
DEBUG: Trying rule: sudo; took: 0:00:00.000011
DEBUG: Trying rule: sudo_command_from_user_path; took: 0:00:00.000008
DEBUG: Trying rule: switch_lang; took: 0:00:00.000001
DEBUG: Trying rule: systemctl; took: 0:00:00.000010
DEBUG: Trying rule: terraform_init; took: 0:00:00.000008
DEBUG: Trying rule: tmux; took: 0:00:00.000008
DEBUG: Trying rule: touch; took: 0:00:00.000007
DEBUG: Trying rule: tsuru_login; took: 0:00:00.000007
DEBUG: Trying rule: tsuru_not_command; took: 0:00:00.000007
DEBUG: Trying rule: unknown_command; took: 0:00:00.000199
DEBUG: Trying rule: unsudo; took: 0:00:00.000001
DEBUG: Trying rule: vagrant_up; took: 0:00:00.000010
DEBUG: Trying rule: whois; took: 0:00:00.000009
DEBUG: Trying rule: workon_doesnt_exists; took: 0:00:00.000008
DEBUG: Trying rule: yarn_alias; took: 0:00:00.000008
DEBUG: Trying rule: yarn_command_not_found; took: 0:00:00.000007
DEBUG: Trying rule: yarn_command_replaced; took: 0:00:00.000008
DEBUG: Trying rule: yarn_help; took: 0:00:00.000008
DEBUG: Trying rule: git_hook_bypass; took: 0:00:00.000007
DEBUG: Trying rule: git_main_master; took: 0:00:00.000007
DEBUG: Trying rule: man_no_space; took: 0:00:00.000001
DEBUG: Trying rule: no_command; took: 0:00:00.000006
DEBUG: Trying rule: missing_space_before_subcommand; took: 0:00:00.000006
DEBUG: Trying rule: wrong_hyphen_before_subcommand; took: 0:00:00.000005
DEBUG: Trying rule: long_form_help; took: 0:00:00.000132
DEBUG: Trying rule: history; took: 0:00:00.001588
djh82 commented 2 years ago

Seems to occur because the is_proper_commnd check on line 27 is much looser than the findall check on the following line:

https://github.com/nvbn/thefuck/blob/d8ddf5a2be9d52ec4bc8c11e79fcc7b3c390b669/thefuck/rules/brew_install.py#L31

Then the findall assumes it will find something and without checking, indexes the first, non-existent, element.

It looks the the expected output has changed.

pyrrolizin commented 2 years ago

The output of brew install has changed. Before it was an Error, now it is a Warning. I create a PR