fix many files in rules/
This commit is contained in:
parent
15526bc817
commit
b7fc483ca4
|
|
@ -4,9 +4,13 @@ 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))
|
||||
return (
|
||||
'pull' in command.script
|
||||
and (
|
||||
'You have unstaged changes' in command.output
|
||||
or 'contains uncommitted changes' in command.output
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@git_support
|
||||
|
|
|
|||
|
|
@ -5,8 +5,10 @@ from thefuck.specific.git import git_support
|
|||
|
||||
@git_support
|
||||
def match(command):
|
||||
return ('push' in command.script_parts
|
||||
and 'git push --set-upstream' in command.output)
|
||||
return (
|
||||
'push' in command.script_parts
|
||||
and 'git push --set-upstream' in command.output
|
||||
)
|
||||
|
||||
|
||||
def _get_upstream_option_index(command_parts):
|
||||
|
|
@ -40,5 +42,7 @@ def get_new_command(command):
|
|||
command_parts.pop(len(command_parts) - 1)
|
||||
|
||||
arguments = re.findall(r'git push (.*)', command.output)[-1].replace("'", r"\'").strip()
|
||||
return replace_argument(" ".join(command_parts), 'push',
|
||||
'push {}'.format(arguments))
|
||||
return replace_argument(
|
||||
" ".join(command_parts), 'push',
|
||||
'push {}'.format(arguments)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ from thefuck.specific.git import git_support
|
|||
|
||||
@git_support
|
||||
def match(command):
|
||||
return ('push' in command.script
|
||||
return (
|
||||
'push' in command.script
|
||||
and '! [rejected]' in command.output
|
||||
and 'failed to push some refs to' in command.output
|
||||
and 'Updates were rejected because the tip of your current branch is behind' in command.output)
|
||||
and 'Updates were rejected because the tip of your current branch is behind' in command.output
|
||||
)
|
||||
|
||||
|
||||
@git_support
|
||||
|
|
|
|||
|
|
@ -5,16 +5,24 @@ from thefuck.specific.git import git_support
|
|||
|
||||
@git_support
|
||||
def match(command):
|
||||
return ('push' in command.script and
|
||||
'! [rejected]' in command.output and
|
||||
'failed to push some refs to' in command.output and
|
||||
('Updates were rejected because the tip of your'
|
||||
' current branch is behind' in command.output or
|
||||
'Updates were rejected because the remote '
|
||||
'contains work that you do' in command.output))
|
||||
return (
|
||||
'push' in command.script and
|
||||
'! [rejected]' in command.output and
|
||||
'failed to push some refs to' in command.output and (
|
||||
(
|
||||
'Updates were rejected because the tip of your'
|
||||
' current branch is behind' in command.output
|
||||
) or (
|
||||
'Updates were rejected because the remote '
|
||||
'contains work that you do' in command.output
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@git_support
|
||||
def get_new_command(command):
|
||||
return shell.and_(replace_argument(command.script, 'push', 'pull'),
|
||||
command.script)
|
||||
return shell.and_(
|
||||
replace_argument(command.script, 'push', 'pull'),
|
||||
command.script
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ from thefuck.specific.git import git_support
|
|||
|
||||
@git_support
|
||||
def match(command):
|
||||
return (' rebase' in command.script and
|
||||
'It seems that there is already a rebase-merge directory' in command.output and
|
||||
'I wonder if you are in the middle of another rebase' in command.output)
|
||||
return (
|
||||
' rebase' in command.script and
|
||||
'It seems that there is already a rebase-merge directory' in command.output and
|
||||
'I wonder if you are in the middle of another rebase' in command.output
|
||||
)
|
||||
|
||||
|
||||
@git_support
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ from thefuck.specific.git import git_support
|
|||
|
||||
@git_support
|
||||
def match(command):
|
||||
return ('set-url' in command.script
|
||||
and 'fatal: No such remote' in command.output)
|
||||
return (
|
||||
'set-url' in command.script
|
||||
and 'fatal: No such remote' in command.output
|
||||
)
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ from thefuck.specific.git import git_support
|
|||
|
||||
@git_support
|
||||
def match(command):
|
||||
return (' rm ' in command.script and
|
||||
'error: the following file has local modifications' in command.output and
|
||||
'use --cached to keep the file, or -f to force removal' in command.output)
|
||||
return (
|
||||
' rm ' in command.script and
|
||||
'error: the following file has local modifications' in command.output and
|
||||
'use --cached to keep the file, or -f to force removal' in command.output
|
||||
)
|
||||
|
||||
|
||||
@git_support
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ from thefuck.specific.git import git_support
|
|||
|
||||
@git_support
|
||||
def match(command):
|
||||
return (' rm ' in command.script
|
||||
and "fatal: not removing '" in command.output
|
||||
and "' recursively without -r" in command.output)
|
||||
return (
|
||||
' rm ' in command.script
|
||||
and "fatal: not removing '" in command.output
|
||||
and "' recursively without -r" in command.output
|
||||
)
|
||||
|
||||
|
||||
@git_support
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ from thefuck.specific.git import git_support
|
|||
|
||||
@git_support
|
||||
def match(command):
|
||||
return (' rm ' in command.script and
|
||||
'error: the following file has changes staged in the index' in command.output and
|
||||
'use --cached to keep the file, or -f to force removal' in command.output)
|
||||
return (
|
||||
' rm ' in command.script and
|
||||
'error: the following file has changes staged in the index' in command.output and
|
||||
'use --cached to keep the file, or -f to force removal' in command.output
|
||||
)
|
||||
|
||||
|
||||
@git_support
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ from thefuck.specific.git import git_support
|
|||
|
||||
@git_support
|
||||
def match(command):
|
||||
return ('stash' in command.script
|
||||
and 'pop' in command.script
|
||||
and 'Your local changes to the following files would be overwritten by merge' in command.output)
|
||||
return (
|
||||
'stash' in command.script
|
||||
and 'pop' in command.script
|
||||
and 'Your local changes to the following files would be overwritten by merge' in command.output
|
||||
)
|
||||
|
||||
|
||||
@git_support
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ from thefuck.specific.git import git_support
|
|||
|
||||
@git_support
|
||||
def match(command):
|
||||
return ('tag' in command.script_parts
|
||||
and 'already exists' in command.output)
|
||||
return (
|
||||
'tag' in command.script_parts
|
||||
and 'already exists' in command.output
|
||||
)
|
||||
|
||||
|
||||
@git_support
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ from thefuck.specific.git import git_support
|
|||
|
||||
@git_support
|
||||
def match(command):
|
||||
return ('error: did you mean `' in command.output
|
||||
and '` (with two dashes ?)' in command.output)
|
||||
return (
|
||||
'error: did you mean `' in command.output
|
||||
and '` (with two dashes ?)' in command.output
|
||||
)
|
||||
|
||||
|
||||
@git_support
|
||||
|
|
|
|||
|
|
@ -8,8 +8,10 @@ from thefuck.utils import for_app
|
|||
|
||||
@for_app('go')
|
||||
def match(command):
|
||||
return (command.script.startswith('go run ')
|
||||
and not command.script.endswith('.go'))
|
||||
return (
|
||||
command.script.startswith('go run ')
|
||||
and not command.script.endswith('.go')
|
||||
)
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
|
|
|
|||
|
|
@ -24,5 +24,7 @@ def match(command):
|
|||
|
||||
def get_new_command(command):
|
||||
closest_subcommand = get_closest(command.script_parts[1], get_golang_commands())
|
||||
return replace_argument(command.script, command.script_parts[1],
|
||||
closest_subcommand)
|
||||
return replace_argument(
|
||||
command.script, command.script_parts[1],
|
||||
closest_subcommand
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ from thefuck.utils import for_app, which
|
|||
|
||||
@for_app('gradle')
|
||||
def match(command):
|
||||
return (not which(command.script_parts[0])
|
||||
and 'not found' in command.output
|
||||
and os.path.isfile('gradlew'))
|
||||
return (
|
||||
not which(command.script_parts[0])
|
||||
and 'not found' in command.output
|
||||
and os.path.isfile('gradlew')
|
||||
)
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
|
|
|
|||
|
|
@ -33,5 +33,7 @@ def get_new_command(command):
|
|||
misspelled_task = regex.findall(command.output)[0].split(':')[0]
|
||||
tasks = _get_all_tasks()
|
||||
fixed = get_closest(misspelled_task, tasks)
|
||||
return command.script.replace(' {}'.format(misspelled_task),
|
||||
' {}'.format(fixed))
|
||||
return command.script.replace(
|
||||
' {}'.format(misspelled_task),
|
||||
' {}'.format(fixed)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -10,13 +10,19 @@ def match(command):
|
|||
|
||||
@cache('gulpfile.js')
|
||||
def get_gulp_tasks():
|
||||
proc = subprocess.Popen(['gulp', '--tasks-simple'],
|
||||
stdout=subprocess.PIPE)
|
||||
return [line.decode('utf-8')[:-1]
|
||||
for line in proc.stdout.readlines()]
|
||||
proc = subprocess.Popen(
|
||||
['gulp', '--tasks-simple'],
|
||||
stdout=subprocess.PIPE
|
||||
)
|
||||
return [
|
||||
line.decode('utf-8')[:-1]
|
||||
for line in proc.stdout.readlines()
|
||||
]
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
wrong_task = re.findall(r"Task '(\w+)' is not in your gulpfile",
|
||||
command.output)[0]
|
||||
wrong_task = re.findall(
|
||||
r"Task '(\w+)' is not in your gulpfile",
|
||||
command.output
|
||||
)[0]
|
||||
return replace_command(command, wrong_task, get_gulp_tasks())
|
||||
|
|
|
|||
|
|
@ -3,13 +3,19 @@ from thefuck.utils import get_close_matches, get_closest, \
|
|||
|
||||
|
||||
def match(command):
|
||||
return len(get_close_matches(command.script,
|
||||
get_valid_history_without_current(command)))
|
||||
return len(
|
||||
get_close_matches(
|
||||
command.script,
|
||||
get_valid_history_without_current(command)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
return get_closest(command.script,
|
||||
get_valid_history_without_current(command))
|
||||
return get_closest(
|
||||
command.script,
|
||||
get_valid_history_without_current(command)
|
||||
)
|
||||
|
||||
|
||||
priority = 9999
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ def get_new_command(command):
|
|||
return ['hostscli websites']
|
||||
|
||||
misspelled_command = re.findall(
|
||||
r'Error: No such command ".*"', command.output)[0]
|
||||
r'Error: No such command ".*"', command.output
|
||||
)[0]
|
||||
commands = ['block', 'unblock', 'websites', 'block_all', 'unblock_all']
|
||||
return replace_command(command, misspelled_command, commands)
|
||||
|
|
|
|||
|
|
@ -6,14 +6,18 @@ from thefuck.specific.sudo import sudo_support
|
|||
@sudo_support
|
||||
@for_app('lein')
|
||||
def match(command):
|
||||
return (command.script.startswith('lein')
|
||||
return (
|
||||
command.script.startswith('lein')
|
||||
and "is not a task. See 'lein help'" in command.output
|
||||
and 'Did you mean this?' in command.output)
|
||||
and 'Did you mean this?' in command.output
|
||||
)
|
||||
|
||||
|
||||
@sudo_support
|
||||
def get_new_command(command):
|
||||
broken_cmd = re.findall(r"'([^']*)' is not a task",
|
||||
command.output)[0]
|
||||
broken_cmd = re.findall(
|
||||
r"'([^']*)' is not a task",
|
||||
command.output
|
||||
)[0]
|
||||
new_cmds = get_all_matched_commands(command.output, 'Did you mean this?')
|
||||
return replace_command(command, broken_cmd, new_cmds)
|
||||
|
|
|
|||
|
|
@ -14,8 +14,10 @@ from thefuck.specific.sudo import sudo_support
|
|||
|
||||
@sudo_support
|
||||
def match(command):
|
||||
return (command.output.endswith("hard link not allowed for directory") and
|
||||
command.script_parts[0] == 'ln')
|
||||
return (
|
||||
command.output.endswith("hard link not allowed for directory")
|
||||
and command.script_parts[0] == 'ln'
|
||||
)
|
||||
|
||||
|
||||
@sudo_support
|
||||
|
|
|
|||
|
|
@ -11,10 +11,12 @@ def _get_destination(script_parts):
|
|||
|
||||
@sudo_support
|
||||
def match(command):
|
||||
return (command.script_parts[0] == 'ln'
|
||||
return (
|
||||
command.script_parts[0] == 'ln'
|
||||
and {'-s', '--symbolic'}.intersection(command.script_parts)
|
||||
and 'File exists' in command.output
|
||||
and _get_destination(command.script_parts))
|
||||
and _get_destination(command.script_parts)
|
||||
)
|
||||
|
||||
|
||||
@sudo_support
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
def match(command):
|
||||
return (command.script.startswith(u'man')
|
||||
and u'command not found' in command.output.lower())
|
||||
return (
|
||||
command.script.startswith(u'man')
|
||||
and u'command not found' in command.output.lower()
|
||||
)
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@ def extract_possibilities(command):
|
|||
|
||||
@for_app('hg')
|
||||
def match(command):
|
||||
return ('hg: unknown command' in command.output
|
||||
return (
|
||||
'hg: unknown command' in command.output
|
||||
and '(did you mean one of ' in command.output
|
||||
or "hg: command '" in command.output
|
||||
and "' is ambiguous:" in command.output)
|
||||
and "' is ambiguous:" in command.output
|
||||
)
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ def _get_executable(script_part):
|
|||
|
||||
|
||||
def match(command):
|
||||
return (not command.script_parts[0] in get_all_executables()
|
||||
and _get_executable(command.script_parts[0]))
|
||||
return (
|
||||
not command.script_parts[0] in get_all_executables()
|
||||
and _get_executable(command.script_parts[0])
|
||||
)
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ from thefuck.specific.sudo import sudo_support
|
|||
|
||||
@sudo_support
|
||||
def match(command):
|
||||
return ('mkdir' in command.script
|
||||
and 'No such file or directory' in command.output)
|
||||
return (
|
||||
'mkdir' in command.script
|
||||
and 'No such file or directory' in command.output
|
||||
)
|
||||
|
||||
|
||||
@sudo_support
|
||||
|
|
|
|||
|
|
@ -7,5 +7,7 @@ def match(command):
|
|||
|
||||
|
||||
def get_new_command(command):
|
||||
return [command.script + ' clean package',
|
||||
command.script + ' clean install']
|
||||
return [
|
||||
command.script + ' clean package',
|
||||
command.script + ' clean install'
|
||||
]
|
||||
|
|
|
|||
|
|
@ -3,13 +3,16 @@ import re
|
|||
|
||||
|
||||
def _get_failed_lifecycle(command):
|
||||
return re.search(r'\[ERROR\] Unknown lifecycle phase "(.+)"',
|
||||
command.output)
|
||||
return re.search(
|
||||
r'\[ERROR\] Unknown lifecycle phase "(.+)"',
|
||||
command.output
|
||||
)
|
||||
|
||||
|
||||
def _getavailable_lifecycles(command):
|
||||
return re.search(
|
||||
r'Available lifecycle phases are: (.+) -> \[Help 1\]', command.output)
|
||||
r'Available lifecycle phases are: (.+) -> \[Help 1\]', command.output
|
||||
)
|
||||
|
||||
|
||||
@for_app('mvn')
|
||||
|
|
|
|||
|
|
@ -5,11 +5,17 @@ from thefuck.specific.sudo import sudo_support
|
|||
|
||||
@sudo_support
|
||||
def match(command):
|
||||
return (not which(command.script_parts[0])
|
||||
and ('not found' in command.output
|
||||
or 'is not recognized as' in command.output)
|
||||
and bool(get_close_matches(command.script_parts[0],
|
||||
get_all_executables())))
|
||||
return (
|
||||
not which(command.script_parts[0])
|
||||
and ('not found' in command.output
|
||||
or 'is not recognized as' in command.output)
|
||||
and bool(
|
||||
get_close_matches(
|
||||
command.script_parts[0],
|
||||
get_all_executables()
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def _get_used_executables(command):
|
||||
|
|
@ -24,16 +30,21 @@ def get_new_command(command):
|
|||
# One from history:
|
||||
already_used = get_closest(
|
||||
old_command, _get_used_executables(command),
|
||||
fallback_to_first=False)
|
||||
fallback_to_first=False
|
||||
)
|
||||
if already_used:
|
||||
new_cmds = [already_used]
|
||||
else:
|
||||
new_cmds = []
|
||||
|
||||
# Other from all executables:
|
||||
new_cmds += [cmd for cmd in get_close_matches(old_command,
|
||||
get_all_executables())
|
||||
if cmd not in new_cmds]
|
||||
new_cmds += [
|
||||
cmd for cmd in get_close_matches(
|
||||
old_command,
|
||||
get_all_executables()
|
||||
)
|
||||
if cmd not in new_cmds
|
||||
]
|
||||
|
||||
return [command.script.replace(old_command, cmd, 1) for cmd in new_cmds]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue