#1131: Improve git_commit_add rule

Add more capabilities to the rule, remove its priority and fix tests
This commit is contained in:
Pablo Santiago Blum de Aguiar
2021-07-08 21:43:35 +02:00
parent 55922e4dbe
commit 11b70526f7
3 changed files with 34 additions and 30 deletions
+8 -6
View File
@@ -1,15 +1,17 @@
from thefuck.utils import replace_argument
from thefuck.utils import eager, replace_argument
from thefuck.specific.git import git_support
priority = 900 # Lower first, default is 1000
@git_support
def match(command):
return ('commit' in command.script_parts
and 'no changes added to commit' in command.output)
return (
"commit" in command.script_parts
and "no changes added to commit" in command.output
)
@eager
@git_support
def get_new_command(command):
return replace_argument(command.script, 'commit', 'commit -a')
for opt in ("-a", "-p"):
yield replace_argument(command.script, "commit", "commit {}".format(opt))