thefuck-leeguoo 3.41__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- thefuck/__init__.py +0 -0
- thefuck/ai.py +765 -0
- thefuck/argument_parser.py +96 -0
- thefuck/conf.py +141 -0
- thefuck/const.py +111 -0
- thefuck/corrector.py +92 -0
- thefuck/entrypoints/__init__.py +0 -0
- thefuck/entrypoints/alias.py +28 -0
- thefuck/entrypoints/fix_command.py +105 -0
- thefuck/entrypoints/main.py +50 -0
- thefuck/entrypoints/not_configured.py +201 -0
- thefuck/entrypoints/setup.py +227 -0
- thefuck/entrypoints/shell_logger.py +79 -0
- thefuck/exceptions.py +10 -0
- thefuck/logs.py +255 -0
- thefuck/output_readers/__init__.py +20 -0
- thefuck/output_readers/read_log.py +108 -0
- thefuck/output_readers/rerun.py +72 -0
- thefuck/output_readers/shell_logger.py +60 -0
- thefuck/rules/__init__.py +0 -0
- thefuck/rules/adb_unknown_command.py +54 -0
- thefuck/rules/ag_literal.py +10 -0
- thefuck/rules/apt_get.py +50 -0
- thefuck/rules/apt_get_search.py +14 -0
- thefuck/rules/apt_invalid_operation.py +63 -0
- thefuck/rules/apt_list_upgradable.py +16 -0
- thefuck/rules/apt_upgrade.py +16 -0
- thefuck/rules/aws_cli.py +17 -0
- thefuck/rules/az_cli.py +17 -0
- thefuck/rules/brew_cask_dependency.py +33 -0
- thefuck/rules/brew_install.py +24 -0
- thefuck/rules/brew_link.py +15 -0
- thefuck/rules/brew_reinstall.py +19 -0
- thefuck/rules/brew_uninstall.py +14 -0
- thefuck/rules/brew_unknown_command.py +82 -0
- thefuck/rules/brew_update_formula.py +12 -0
- thefuck/rules/cargo.py +6 -0
- thefuck/rules/cargo_no_command.py +15 -0
- thefuck/rules/cat_dir.py +14 -0
- thefuck/rules/cd_correction.py +61 -0
- thefuck/rules/cd_cs.py +21 -0
- thefuck/rules/cd_mkdir.py +21 -0
- thefuck/rules/cd_parent.py +16 -0
- thefuck/rules/chmod_x.py +15 -0
- thefuck/rules/choco_install.py +25 -0
- thefuck/rules/composer_not_command.py +22 -0
- thefuck/rules/conda_mistype.py +17 -0
- thefuck/rules/cp_create_destination.py +15 -0
- thefuck/rules/cp_omitting_directory.py +15 -0
- thefuck/rules/cpp11.py +12 -0
- thefuck/rules/dirty_untar.py +53 -0
- thefuck/rules/dirty_unzip.py +60 -0
- thefuck/rules/django_south_ghost.py +8 -0
- thefuck/rules/django_south_merge.py +8 -0
- thefuck/rules/dnf_no_such_command.py +37 -0
- thefuck/rules/docker_image_being_used_by_container.py +20 -0
- thefuck/rules/docker_login.py +13 -0
- thefuck/rules/docker_not_command.py +49 -0
- thefuck/rules/dry.py +15 -0
- thefuck/rules/fab_command_not_found.py +38 -0
- thefuck/rules/fix_alt_space.py +15 -0
- thefuck/rules/fix_file.py +80 -0
- thefuck/rules/gem_unknown_command.py +36 -0
- thefuck/rules/git_add.py +27 -0
- thefuck/rules/git_add_force.py +13 -0
- thefuck/rules/git_bisect_usage.py +16 -0
- thefuck/rules/git_branch_0flag.py +24 -0
- thefuck/rules/git_branch_delete.py +13 -0
- thefuck/rules/git_branch_delete_checked_out.py +19 -0
- thefuck/rules/git_branch_exists.py +25 -0
- thefuck/rules/git_branch_list.py +14 -0
- thefuck/rules/git_checkout.py +49 -0
- thefuck/rules/git_clone_git_clone.py +12 -0
- thefuck/rules/git_clone_missing.py +42 -0
- thefuck/rules/git_commit_add.py +17 -0
- thefuck/rules/git_commit_amend.py +11 -0
- thefuck/rules/git_commit_reset.py +11 -0
- thefuck/rules/git_diff_no_index.py +16 -0
- thefuck/rules/git_diff_staged.py +13 -0
- thefuck/rules/git_fix_stash.py +37 -0
- thefuck/rules/git_flag_after_filename.py +31 -0
- thefuck/rules/git_help_aliased.py +12 -0
- thefuck/rules/git_hook_bypass.py +27 -0
- thefuck/rules/git_lfs_mistype.py +18 -0
- thefuck/rules/git_main_master.py +16 -0
- thefuck/rules/git_merge.py +18 -0
- thefuck/rules/git_merge_unrelated.py +12 -0
- thefuck/rules/git_not_command.py +18 -0
- thefuck/rules/git_pull.py +16 -0
- thefuck/rules/git_pull_clone.py +13 -0
- thefuck/rules/git_pull_uncommitted_changes.py +14 -0
- thefuck/rules/git_push.py +44 -0
- thefuck/rules/git_push_different_branch_names.py +12 -0
- thefuck/rules/git_push_force.py +18 -0
- thefuck/rules/git_push_pull.py +20 -0
- thefuck/rules/git_push_without_commits.py +12 -0
- thefuck/rules/git_rebase_merge_dir.py +17 -0
- thefuck/rules/git_rebase_no_changes.py +13 -0
- thefuck/rules/git_remote_delete.py +13 -0
- thefuck/rules/git_remote_seturl_add.py +12 -0
- thefuck/rules/git_rm_local_modifications.py +19 -0
- thefuck/rules/git_rm_recursive.py +16 -0
- thefuck/rules/git_rm_staged.py +19 -0
- thefuck/rules/git_stash.py +15 -0
- thefuck/rules/git_stash_pop.py +18 -0
- thefuck/rules/git_tag_force.py +13 -0
- thefuck/rules/git_two_dashes.py +14 -0
- thefuck/rules/go_run.py +16 -0
- thefuck/rules/go_unknown_command.py +28 -0
- thefuck/rules/gradle_no_task.py +34 -0
- thefuck/rules/gradle_wrapper.py +13 -0
- thefuck/rules/grep_arguments_order.py +23 -0
- thefuck/rules/grep_recursive.py +10 -0
- thefuck/rules/grunt_task_not_found.py +37 -0
- thefuck/rules/gulp_not_task.py +22 -0
- thefuck/rules/has_exists_script.py +13 -0
- thefuck/rules/heroku_multiple_apps.py +12 -0
- thefuck/rules/heroku_not_command.py +11 -0
- thefuck/rules/history.py +15 -0
- thefuck/rules/hostscli.py +27 -0
- thefuck/rules/ifconfig_device_not_found.py +23 -0
- thefuck/rules/java.py +17 -0
- thefuck/rules/javac.py +18 -0
- thefuck/rules/lein_not_task.py +19 -0
- thefuck/rules/ln_no_hard_link.py +23 -0
- thefuck/rules/ln_s_order.py +26 -0
- thefuck/rules/long_form_help.py +27 -0
- thefuck/rules/ls_all.py +10 -0
- thefuck/rules/ls_lah.py +12 -0
- thefuck/rules/man.py +33 -0
- thefuck/rules/man_no_space.py +10 -0
- thefuck/rules/mercurial.py +27 -0
- thefuck/rules/missing_space_before_subcommand.py +21 -0
- thefuck/rules/mkdir_p.py +13 -0
- thefuck/rules/mvn_no_command.py +11 -0
- thefuck/rules/mvn_unknown_lifecycle_phase.py +30 -0
- thefuck/rules/nixos_cmd_not_found.py +15 -0
- thefuck/rules/no_command.py +41 -0
- thefuck/rules/no_such_file.py +30 -0
- thefuck/rules/npm_missing_script.py +17 -0
- thefuck/rules/npm_run_script.py +17 -0
- thefuck/rules/npm_wrong_command.py +42 -0
- thefuck/rules/omnienv_no_such_command.py +35 -0
- thefuck/rules/open.py +40 -0
- thefuck/rules/pacman.py +17 -0
- thefuck/rules/pacman_invalid_option.py +20 -0
- thefuck/rules/pacman_not_found.py +26 -0
- thefuck/rules/path_from_history.py +53 -0
- thefuck/rules/php_s.py +11 -0
- thefuck/rules/pip_install.py +15 -0
- thefuck/rules/pip_unknown_command.py +19 -0
- thefuck/rules/port_already_in_use.py +40 -0
- thefuck/rules/prove_recursively.py +27 -0
- thefuck/rules/python_command.py +17 -0
- thefuck/rules/python_execute.py +15 -0
- thefuck/rules/python_module_error.py +13 -0
- thefuck/rules/quotation_marks.py +12 -0
- thefuck/rules/rails_migrations_pending.py +14 -0
- thefuck/rules/react_native_command_unrecognized.py +34 -0
- thefuck/rules/remove_shell_prompt_literal.py +23 -0
- thefuck/rules/remove_trailing_cedilla.py +11 -0
- thefuck/rules/rm_dir.py +16 -0
- thefuck/rules/rm_root.py +16 -0
- thefuck/rules/scm_correction.py +32 -0
- thefuck/rules/sed_unterminated_s.py +18 -0
- thefuck/rules/sl_ls.py +14 -0
- thefuck/rules/ssh_known_hosts.py +37 -0
- thefuck/rules/sudo.py +47 -0
- thefuck/rules/sudo_command_from_user_path.py +21 -0
- thefuck/rules/switch_lang.py +117 -0
- thefuck/rules/systemctl.py +22 -0
- thefuck/rules/terraform_init.py +13 -0
- thefuck/rules/terraform_no_command.py +16 -0
- thefuck/rules/test.py.py +10 -0
- thefuck/rules/tmux.py +18 -0
- thefuck/rules/touch.py +14 -0
- thefuck/rules/tsuru_login.py +12 -0
- thefuck/rules/tsuru_not_command.py +15 -0
- thefuck/rules/unknown_command.py +13 -0
- thefuck/rules/unsudo.py +15 -0
- thefuck/rules/vagrant_up.py +21 -0
- thefuck/rules/whois.py +34 -0
- thefuck/rules/workon_doesnt_exists.py +32 -0
- thefuck/rules/wrong_hyphen_before_subcommand.py +20 -0
- thefuck/rules/yarn_alias.py +14 -0
- thefuck/rules/yarn_command_not_found.py +43 -0
- thefuck/rules/yarn_command_replaced.py +13 -0
- thefuck/rules/yarn_help.py +17 -0
- thefuck/rules/yum_invalid_operation.py +39 -0
- thefuck/shells/__init__.py +52 -0
- thefuck/shells/bash.py +94 -0
- thefuck/shells/fish.py +131 -0
- thefuck/shells/generic.py +154 -0
- thefuck/shells/powershell.py +43 -0
- thefuck/shells/tcsh.py +44 -0
- thefuck/shells/zsh.py +98 -0
- thefuck/specific/__init__.py +0 -0
- thefuck/specific/apt.py +3 -0
- thefuck/specific/archlinux.py +48 -0
- thefuck/specific/brew.py +15 -0
- thefuck/specific/dnf.py +3 -0
- thefuck/specific/git.py +32 -0
- thefuck/specific/nix.py +3 -0
- thefuck/specific/npm.py +21 -0
- thefuck/specific/sudo.py +18 -0
- thefuck/specific/yum.py +3 -0
- thefuck/system/__init__.py +7 -0
- thefuck/system/unix.py +57 -0
- thefuck/system/win32.py +43 -0
- thefuck/types.py +261 -0
- thefuck/ui.py +116 -0
- thefuck/utils.py +385 -0
- thefuck_leeguoo-3.41.dist-info/METADATA +681 -0
- thefuck_leeguoo-3.41.dist-info/RECORD +218 -0
- thefuck_leeguoo-3.41.dist-info/WHEEL +6 -0
- thefuck_leeguoo-3.41.dist-info/entry_points.txt +3 -0
- thefuck_leeguoo-3.41.dist-info/licenses/LICENSE.md +22 -0
- thefuck_leeguoo-3.41.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'''
|
|
2
|
+
Rule: git_clone_missing
|
|
3
|
+
|
|
4
|
+
Correct missing `git clone` command when pasting a git URL
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
>>> https://github.com/nvbn/thefuck.git
|
|
8
|
+
git clone https://github.com/nvbn/thefuck.git
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Author: Miguel Guthridge
|
|
12
|
+
'''
|
|
13
|
+
from six.moves.urllib import parse
|
|
14
|
+
from thefuck.utils import which
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def match(command):
|
|
18
|
+
# We want it to be a URL by itself
|
|
19
|
+
if len(command.script_parts) != 1:
|
|
20
|
+
return False
|
|
21
|
+
# Ensure we got the error we expected
|
|
22
|
+
if which(command.script_parts[0]) or not (
|
|
23
|
+
'No such file or directory' in command.output
|
|
24
|
+
or 'not found' in command.output
|
|
25
|
+
or 'is not recognised as' in command.output
|
|
26
|
+
):
|
|
27
|
+
return False
|
|
28
|
+
url = parse.urlparse(command.script, scheme='ssh')
|
|
29
|
+
# HTTP URLs need a network address
|
|
30
|
+
if not url.netloc and url.scheme != 'ssh':
|
|
31
|
+
return False
|
|
32
|
+
# SSH needs a username and a splitter between the path
|
|
33
|
+
if url.scheme == 'ssh' and not (
|
|
34
|
+
'@' in command.script
|
|
35
|
+
and ':' in command.script
|
|
36
|
+
):
|
|
37
|
+
return False
|
|
38
|
+
return url.scheme in ['http', 'https', 'ssh']
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def get_new_command(command):
|
|
42
|
+
return 'git clone ' + command.script
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from thefuck.utils import eager, replace_argument
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
return (
|
|
8
|
+
"commit" in command.script_parts
|
|
9
|
+
and "no changes added to commit" in command.output
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@eager
|
|
14
|
+
@git_support
|
|
15
|
+
def get_new_command(command):
|
|
16
|
+
for opt in ("-a", "-p"):
|
|
17
|
+
yield replace_argument(command.script, "commit", "commit {}".format(opt))
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from thefuck.utils import replace_argument
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
files = [arg for arg in command.script_parts[2:]
|
|
8
|
+
if not arg.startswith('-')]
|
|
9
|
+
return ('diff' in command.script
|
|
10
|
+
and '--no-index' not in command.script
|
|
11
|
+
and len(files) == 2)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@git_support
|
|
15
|
+
def get_new_command(command):
|
|
16
|
+
return replace_argument(command.script, 'diff', 'diff --no-index')
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from thefuck.utils import replace_argument
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
return ('diff' in command.script and
|
|
8
|
+
'--staged' not in command.script)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@git_support
|
|
12
|
+
def get_new_command(command):
|
|
13
|
+
return replace_argument(command.script, 'diff', 'diff --staged')
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from thefuck import utils
|
|
2
|
+
from thefuck.utils import replace_argument
|
|
3
|
+
from thefuck.specific.git import git_support
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@git_support
|
|
7
|
+
def match(command):
|
|
8
|
+
if command.script_parts and len(command.script_parts) > 1:
|
|
9
|
+
return (command.script_parts[1] == 'stash'
|
|
10
|
+
and 'usage:' in command.output)
|
|
11
|
+
else:
|
|
12
|
+
return False
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# git's output here is too complicated to be parsed (see the test file)
|
|
16
|
+
stash_commands = (
|
|
17
|
+
'apply',
|
|
18
|
+
'branch',
|
|
19
|
+
'clear',
|
|
20
|
+
'drop',
|
|
21
|
+
'list',
|
|
22
|
+
'pop',
|
|
23
|
+
'save',
|
|
24
|
+
'show')
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@git_support
|
|
28
|
+
def get_new_command(command):
|
|
29
|
+
stash_cmd = command.script_parts[2]
|
|
30
|
+
fixed = utils.get_closest(stash_cmd, stash_commands, fallback_to_first=False)
|
|
31
|
+
|
|
32
|
+
if fixed is not None:
|
|
33
|
+
return replace_argument(command.script, stash_cmd, fixed)
|
|
34
|
+
else:
|
|
35
|
+
cmd = command.script_parts[:]
|
|
36
|
+
cmd.insert(2, 'save')
|
|
37
|
+
return ' '.join(cmd)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
error_pattern = "fatal: bad flag '(.*?)' used after filename"
|
|
5
|
+
error_pattern2 = "fatal: option '(.*?)' must come before non-option arguments"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@git_support
|
|
9
|
+
def match(command):
|
|
10
|
+
return re.search(error_pattern, command.output) or re.search(error_pattern2, command.output)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@git_support
|
|
14
|
+
def get_new_command(command):
|
|
15
|
+
command_parts = command.script_parts[:]
|
|
16
|
+
|
|
17
|
+
# find the bad flag
|
|
18
|
+
bad_flag = match(command).group(1)
|
|
19
|
+
bad_flag_index = command_parts.index(bad_flag)
|
|
20
|
+
|
|
21
|
+
# find the filename
|
|
22
|
+
for index in reversed(range(bad_flag_index)):
|
|
23
|
+
if command_parts[index][0] != '-':
|
|
24
|
+
filename_index = index
|
|
25
|
+
break
|
|
26
|
+
|
|
27
|
+
# swap them
|
|
28
|
+
command_parts[bad_flag_index], command_parts[filename_index] = \
|
|
29
|
+
command_parts[filename_index], command_parts[bad_flag_index] # noqa: E122
|
|
30
|
+
|
|
31
|
+
return u' '.join(command_parts)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from thefuck.specific.git import git_support
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@git_support
|
|
5
|
+
def match(command):
|
|
6
|
+
return 'help' in command.script and ' is aliased to ' in command.output
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@git_support
|
|
10
|
+
def get_new_command(command):
|
|
11
|
+
aliased = command.output.split('`', 2)[2].split("'", 1)[0].split(' ', 1)[0]
|
|
12
|
+
return 'git help {}'.format(aliased)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from thefuck.utils import replace_argument
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
hooked_commands = ("am", "commit", "push")
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@git_support
|
|
8
|
+
def match(command):
|
|
9
|
+
return any(
|
|
10
|
+
hooked_command in command.script_parts for hooked_command in hooked_commands
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@git_support
|
|
15
|
+
def get_new_command(command):
|
|
16
|
+
hooked_command = next(
|
|
17
|
+
hooked_command
|
|
18
|
+
for hooked_command in hooked_commands
|
|
19
|
+
if hooked_command in command.script_parts
|
|
20
|
+
)
|
|
21
|
+
return replace_argument(
|
|
22
|
+
command.script, hooked_command, hooked_command + " --no-verify"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
priority = 1100
|
|
27
|
+
requires_output = False
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from thefuck.utils import get_all_matched_commands, replace_command
|
|
3
|
+
from thefuck.specific.git import git_support
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@git_support
|
|
7
|
+
def match(command):
|
|
8
|
+
'''
|
|
9
|
+
Match a mistyped command
|
|
10
|
+
'''
|
|
11
|
+
return 'lfs' in command.script and 'Did you mean this?' in command.output
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@git_support
|
|
15
|
+
def get_new_command(command):
|
|
16
|
+
broken_cmd = re.findall(r'Error: unknown command "([^"]*)" for "git-lfs"', command.output)[0]
|
|
17
|
+
matched = get_all_matched_commands(command.output, ['Did you mean', ' for usage.'])
|
|
18
|
+
return replace_command(command, broken_cmd, matched)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from thefuck.specific.git import git_support
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@git_support
|
|
5
|
+
def match(command):
|
|
6
|
+
return "'master'" in command.output or "'main'" in command.output
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@git_support
|
|
10
|
+
def get_new_command(command):
|
|
11
|
+
if "'master'" in command.output:
|
|
12
|
+
return command.script.replace("master", "main")
|
|
13
|
+
return command.script.replace("main", "master")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
priority = 1200
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from thefuck.utils import replace_argument
|
|
3
|
+
from thefuck.specific.git import git_support
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@git_support
|
|
7
|
+
def match(command):
|
|
8
|
+
return ('merge' in command.script
|
|
9
|
+
and ' - not something we can merge' in command.output
|
|
10
|
+
and 'Did you mean this?' in command.output)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@git_support
|
|
14
|
+
def get_new_command(command):
|
|
15
|
+
unknown_branch = re.findall(r'merge: (.+) - not something we can merge', command.output)[0]
|
|
16
|
+
remote_branch = re.findall(r'Did you mean this\?\n\t([^\n]+)', command.output)[0]
|
|
17
|
+
|
|
18
|
+
return replace_argument(command.script, unknown_branch, remote_branch)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from thefuck.specific.git import git_support
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@git_support
|
|
5
|
+
def match(command):
|
|
6
|
+
return ('merge' in command.script
|
|
7
|
+
and 'fatal: refusing to merge unrelated histories' in command.output)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@git_support
|
|
11
|
+
def get_new_command(command):
|
|
12
|
+
return command.script + ' --allow-unrelated-histories'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from thefuck.utils import get_all_matched_commands, replace_command
|
|
3
|
+
from thefuck.specific.git import git_support
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@git_support
|
|
7
|
+
def match(command):
|
|
8
|
+
return (" is not a git command. See 'git --help'." in command.output
|
|
9
|
+
and ('The most similar command' in command.output
|
|
10
|
+
or 'Did you mean' in command.output))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@git_support
|
|
14
|
+
def get_new_command(command):
|
|
15
|
+
broken_cmd = re.findall(r"git: '([^']*)' is not a git command",
|
|
16
|
+
command.output)[0]
|
|
17
|
+
matched = get_all_matched_commands(command.output, ['The most similar command', 'Did you mean'])
|
|
18
|
+
return replace_command(command, broken_cmd, matched)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from thefuck.shells import shell
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
return 'pull' in command.script and 'set-upstream' in command.output
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@git_support
|
|
11
|
+
def get_new_command(command):
|
|
12
|
+
line = command.output.split('\n')[-3].strip()
|
|
13
|
+
branch = line.split(' ')[-1]
|
|
14
|
+
set_upstream = line.replace('<remote>', 'origin')\
|
|
15
|
+
.replace('<branch>', branch)
|
|
16
|
+
return shell.and_(set_upstream, command.script)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from thefuck.utils import replace_argument
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
return ('fatal: Not a git repository' in command.output
|
|
8
|
+
and "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)." in command.output)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@git_support
|
|
12
|
+
def get_new_command(command):
|
|
13
|
+
return replace_argument(command.script, 'pull', 'clone')
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from thefuck.shells import shell
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
return ('pull' in command.script
|
|
8
|
+
and ('You have unstaged changes' in command.output
|
|
9
|
+
or 'contains uncommitted changes' in command.output))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@git_support
|
|
13
|
+
def get_new_command(command):
|
|
14
|
+
return shell.and_('git stash', 'git pull', 'git stash pop')
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from thefuck.utils import replace_argument
|
|
3
|
+
from thefuck.specific.git import git_support
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@git_support
|
|
7
|
+
def match(command):
|
|
8
|
+
return ('push' in command.script_parts
|
|
9
|
+
and 'git push --set-upstream' in command.output)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_upstream_option_index(command_parts):
|
|
13
|
+
if '--set-upstream' in command_parts:
|
|
14
|
+
return command_parts.index('--set-upstream')
|
|
15
|
+
elif '-u' in command_parts:
|
|
16
|
+
return command_parts.index('-u')
|
|
17
|
+
else:
|
|
18
|
+
return None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@git_support
|
|
22
|
+
def get_new_command(command):
|
|
23
|
+
# If --set-upstream or -u are passed, remove it and its argument. This is
|
|
24
|
+
# because the remaining arguments are concatenated onto the command suggested
|
|
25
|
+
# by git, which includes --set-upstream and its argument
|
|
26
|
+
command_parts = command.script_parts[:]
|
|
27
|
+
upstream_option_index = _get_upstream_option_index(command_parts)
|
|
28
|
+
|
|
29
|
+
if upstream_option_index is not None:
|
|
30
|
+
command_parts.pop(upstream_option_index)
|
|
31
|
+
|
|
32
|
+
# In case of `git push -u` we don't have next argument:
|
|
33
|
+
if len(command_parts) > upstream_option_index:
|
|
34
|
+
command_parts.pop(upstream_option_index)
|
|
35
|
+
else:
|
|
36
|
+
# the only non-qualified permitted options are the repository and refspec; git's
|
|
37
|
+
# suggestion include them, so they won't be lost, but would be duplicated otherwise.
|
|
38
|
+
push_idx = command_parts.index('push') + 1
|
|
39
|
+
while len(command_parts) > push_idx and command_parts[len(command_parts) - 1][0] != '-':
|
|
40
|
+
command_parts.pop(len(command_parts) - 1)
|
|
41
|
+
|
|
42
|
+
arguments = re.findall(r'git push (.*)', command.output)[-1].replace("'", r"\'").strip()
|
|
43
|
+
return replace_argument(" ".join(command_parts), 'push',
|
|
44
|
+
'push {}'.format(arguments))
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
return "push" in command.script and "The upstream branch of your current branch does not match" in command.output
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@git_support
|
|
11
|
+
def get_new_command(command):
|
|
12
|
+
return re.findall(r'^ +(git push [^\s]+ [^\s]+)', command.output, re.MULTILINE)[0]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from thefuck.utils import replace_argument
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
return ('push' in command.script
|
|
8
|
+
and '! [rejected]' in command.output
|
|
9
|
+
and 'failed to push some refs to' in command.output
|
|
10
|
+
and 'Updates were rejected because the tip of your current branch is behind' in command.output)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@git_support
|
|
14
|
+
def get_new_command(command):
|
|
15
|
+
return replace_argument(command.script, 'push', 'push --force-with-lease')
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
enabled_by_default = False
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from thefuck.shells import shell
|
|
2
|
+
from thefuck.utils import replace_argument
|
|
3
|
+
from thefuck.specific.git import git_support
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@git_support
|
|
7
|
+
def match(command):
|
|
8
|
+
return ('push' in command.script and
|
|
9
|
+
'! [rejected]' in command.output and
|
|
10
|
+
'failed to push some refs to' in command.output and
|
|
11
|
+
('Updates were rejected because the tip of your'
|
|
12
|
+
' current branch is behind' in command.output or
|
|
13
|
+
'Updates were rejected because the remote '
|
|
14
|
+
'contains work that you do' in command.output))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@git_support
|
|
18
|
+
def get_new_command(command):
|
|
19
|
+
return shell.and_(replace_argument(command.script, 'push', 'pull'),
|
|
20
|
+
command.script)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from thefuck.shells import shell
|
|
3
|
+
from thefuck.specific.git import git_support
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@git_support
|
|
7
|
+
def match(command):
|
|
8
|
+
return bool(re.search(r"src refspec \w+ does not match any", command.output))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_new_command(command):
|
|
12
|
+
return shell.and_('git commit -m "Initial commit"', command.script)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from thefuck.utils import get_close_matches
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
return (' rebase' in command.script and
|
|
8
|
+
'It seems that there is already a rebase-merge directory' in command.output and
|
|
9
|
+
'I wonder if you are in the middle of another rebase' in command.output)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@git_support
|
|
13
|
+
def get_new_command(command):
|
|
14
|
+
command_list = ['git rebase --continue', 'git rebase --abort', 'git rebase --skip']
|
|
15
|
+
rm_cmd = command.output.split('\n')[-4]
|
|
16
|
+
command_list.append(rm_cmd.strip())
|
|
17
|
+
return get_close_matches(command.script, command_list, 4, 0)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from thefuck.specific.git import git_support
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@git_support
|
|
5
|
+
def match(command):
|
|
6
|
+
return (
|
|
7
|
+
{'rebase', '--continue'}.issubset(command.script_parts) and
|
|
8
|
+
'No changes - did you forget to use \'git add\'?' in command.output
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_new_command(command):
|
|
13
|
+
return 'git rebase --skip'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from thefuck.utils import replace_argument
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
return ('set-url' in command.script
|
|
8
|
+
and 'fatal: No such remote' in command.output)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_new_command(command):
|
|
12
|
+
return replace_argument(command.script, 'set-url', 'add')
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from thefuck.specific.git import git_support
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@git_support
|
|
5
|
+
def match(command):
|
|
6
|
+
return (' rm ' in command.script and
|
|
7
|
+
'error: the following file has local modifications' in command.output and
|
|
8
|
+
'use --cached to keep the file, or -f to force removal' in command.output)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@git_support
|
|
12
|
+
def get_new_command(command):
|
|
13
|
+
command_parts = command.script_parts[:]
|
|
14
|
+
index = command_parts.index('rm') + 1
|
|
15
|
+
command_parts.insert(index, '--cached')
|
|
16
|
+
command_list = [u' '.join(command_parts)]
|
|
17
|
+
command_parts[index] = '-f'
|
|
18
|
+
command_list.append(u' '.join(command_parts))
|
|
19
|
+
return command_list
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from thefuck.specific.git import git_support
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@git_support
|
|
5
|
+
def match(command):
|
|
6
|
+
return (' rm ' in command.script
|
|
7
|
+
and "fatal: not removing '" in command.output
|
|
8
|
+
and "' recursively without -r" in command.output)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@git_support
|
|
12
|
+
def get_new_command(command):
|
|
13
|
+
command_parts = command.script_parts[:]
|
|
14
|
+
index = command_parts.index('rm') + 1
|
|
15
|
+
command_parts.insert(index, '-r')
|
|
16
|
+
return u' '.join(command_parts)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from thefuck.specific.git import git_support
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@git_support
|
|
5
|
+
def match(command):
|
|
6
|
+
return (' rm ' in command.script and
|
|
7
|
+
'error: the following file has changes staged in the index' in command.output and
|
|
8
|
+
'use --cached to keep the file, or -f to force removal' in command.output)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@git_support
|
|
12
|
+
def get_new_command(command):
|
|
13
|
+
command_parts = command.script_parts[:]
|
|
14
|
+
index = command_parts.index('rm') + 1
|
|
15
|
+
command_parts.insert(index, '--cached')
|
|
16
|
+
command_list = [u' '.join(command_parts)]
|
|
17
|
+
command_parts[index] = '-f'
|
|
18
|
+
command_list.append(u' '.join(command_parts))
|
|
19
|
+
return command_list
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from thefuck.shells import shell
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
# catches "Please commit or stash them" and "Please, commit your changes or
|
|
8
|
+
# stash them before you can switch branches."
|
|
9
|
+
return 'or stash them' in command.output
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@git_support
|
|
13
|
+
def get_new_command(command):
|
|
14
|
+
formatme = shell.and_('git stash', '{}')
|
|
15
|
+
return formatme.format(command.script)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from thefuck.shells import shell
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
return ('stash' in command.script
|
|
8
|
+
and 'pop' in command.script
|
|
9
|
+
and 'Your local changes to the following files would be overwritten by merge' in command.output)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@git_support
|
|
13
|
+
def get_new_command(command):
|
|
14
|
+
return shell.and_('git add --update', 'git stash pop', 'git reset .')
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# make it come before the other applicable rules
|
|
18
|
+
priority = 900
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from thefuck.utils import replace_argument
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
return ('tag' in command.script_parts
|
|
8
|
+
and 'already exists' in command.output)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@git_support
|
|
12
|
+
def get_new_command(command):
|
|
13
|
+
return replace_argument(command.script, 'tag', 'tag --force')
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from thefuck.utils import replace_argument
|
|
2
|
+
from thefuck.specific.git import git_support
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@git_support
|
|
6
|
+
def match(command):
|
|
7
|
+
return ('error: did you mean `' in command.output
|
|
8
|
+
and '` (with two dashes ?)' in command.output)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@git_support
|
|
12
|
+
def get_new_command(command):
|
|
13
|
+
to = command.output.split('`')[1]
|
|
14
|
+
return replace_argument(command.script, to[1:], to)
|