mirror of
https://github.com/nvbn/thefuck.git
synced 2025-08-24 06:52:30 +01:00
.github
tests
thefuck
entrypoints
output_readers
rules
__init__.py
adb_unknown_command.py
ag_literal.py
apt_get.py
apt_get_search.py
apt_invalid_operation.py
apt_list_upgradable.py
apt_upgrade.py
aws_cli.py
az_cli.py
brew_cask_dependency.py
brew_install.py
brew_link.py
brew_reinstall.py
brew_uninstall.py
brew_unknown_command.py
brew_update_formula.py
cargo.py
cargo_no_command.py
cat_dir.py
cd_correction.py
cd_mkdir.py
cd_parent.py
chmod_x.py
choco_install.py
composer_not_command.py
cp_omitting_directory.py
cpp11.py
dirty_untar.py
dirty_unzip.py
django_south_ghost.py
django_south_merge.py
dnf_no_such_command.py
docker_image_being_used_by_container.py
docker_login.py
docker_not_command.py
dry.py
fab_command_not_found.py
fix_alt_space.py
fix_file.py
gem_unknown_command.py
git_add.py
git_add_force.py
git_bisect_usage.py
git_branch_delete.py
git_branch_delete_checked_out.py
git_branch_exists.py
git_branch_list.py
git_checkout.py
git_commit_amend.py
git_commit_reset.py
git_diff_no_index.py
git_diff_staged.py
git_fix_stash.py
git_flag_after_filename.py
git_help_aliased.py
git_merge.py
git_merge_unrelated.py
git_not_command.py
git_pull.py
git_pull_clone.py
git_pull_uncommitted_changes.py
git_push.py
git_push_different_branch_names.py
git_push_force.py
git_push_pull.py
git_push_without_commits.py
git_rebase_merge_dir.py
git_rebase_no_changes.py
git_remote_delete.py
git_remote_seturl_add.py
git_rm_local_modifications.py
git_rm_recursive.py
git_rm_staged.py
git_stash.py
git_stash_pop.py
git_tag_force.py
git_two_dashes.py
go_run.py
go_unknown_command.py
gradle_no_task.py
gradle_wrapper.py
grep_arguments_order.py
grep_recursive.py
grunt_task_not_found.py
gulp_not_task.py
has_exists_script.py
heroku_multiple_apps.py
heroku_not_command.py
history.py
hostscli.py
ifconfig_device_not_found.py
java.py
javac.py
lein_not_task.py
ln_no_hard_link.py
ln_s_order.py
long_form_help.py
ls_all.py
ls_lah.py
man.py
man_no_space.py
mercurial.py
missing_space_before_subcommand.py
mkdir_p.py
mvn_no_command.py
mvn_unknown_lifecycle_phase.py
nixos_cmd_not_found.py
no_command.py
no_such_file.py
npm_missing_script.py
npm_run_script.py
npm_wrong_command.py
open.py
pacman.py
pacman_not_found.py
path_from_history.py
php_s.py
pip_install.py
pip_unknown_command.py
port_already_in_use.py
prove_recursively.py
pyenv_no_such_command.py
python_command.py
python_execute.py
quotation_marks.py
react_native_command_unrecognized.py
remove_shell_prompt_literal.py
remove_trailing_cedilla.py
rm_dir.py
rm_root.py
scm_correction.py
sed_unterminated_s.py
sl_ls.py
ssh_known_hosts.py
sudo.py
sudo_command_from_user_path.py
switch_lang.py
systemctl.py
terraform_init.py
test.py.py
tmux.py
touch.py
tsuru_login.py
tsuru_not_command.py
unknown_command.py
unsudo.py
vagrant_up.py
whois.py
workon_doesnt_exists.py
yarn_alias.py
yarn_command_not_found.py
yarn_command_replaced.py
yarn_help.py
yum_invalid_operation.py
shells
specific
system
__init__.py
argument_parser.py
conf.py
const.py
corrector.py
exceptions.py
logs.py
types.py
ui.py
utils.py
.editorconfig
.gitignore
.travis.yml
CONTRIBUTING.md
LICENSE.md
MANIFEST.in
README.md
appveyor.yml
example.gif
example_instant_mode.gif
fastentrypoints.py
install.sh
release.py
requirements.txt
setup.cfg
setup.py
snapcraft.yaml
tox.ini
* #N/A: Ignore W504 line break after binary operator W504 is now part of flake8 current version 3.6 * #N/A: Fix invalid escape sequences * #N/A: Remove conflicting path before installing gcc with brew
18 lines
520 B
Python
18 lines
520 B
Python
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):
|
|
mistake = re.search(INVALID_CHOICE, command.output).group(0)
|
|
options = re.findall(OPTIONS, command.output, flags=re.MULTILINE)
|
|
return [replace_argument(command.script, mistake, o) for o in options]
|