1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 14:48:49 +00:00

#N/A Add initial support to the --post-match arg

This commit is contained in:
Payton Garland 2019-02-24 02:32:44 -06:00
parent db488d35eb
commit 90afdb04ba
3 changed files with 17 additions and 0 deletions

View File

@ -50,6 +50,10 @@ class Parser(object):
'command',
nargs='*',
help='command that should be fixed')
self._parser.add_argument(
'--post-match',
action='store_true', #TODO: Check if store_true is necessary
help=SUPPRESS)
def _add_conflicting_arguments(self):
"""It's too dangerous to use `-y` and `-r` together."""

View File

@ -11,6 +11,7 @@ from ..utils import get_installation_info # noqa: E402
from ..shells import shell # noqa: E402
from .alias import print_alias # noqa: E402
from .fix_command import fix_command # noqa: E402
from .post_match_execute import post_match_execute # noqa: E402
def main():
@ -22,6 +23,9 @@ def main():
elif known_args.version:
logs.version(get_installation_info().version,
sys.version.split()[0], shell.info())
elif known_args.post_match:
print ("OPE")
# post_match_execute(known_args)
elif known_args.command or 'TF_HISTORY' in os.environ:
fix_command(known_args)
elif known_args.alias:

View File

@ -0,0 +1,9 @@
from thefuck.types import Rule
def post_match_execute(known_args):
"""Executes post match funtion. Used when `thefuck` called with `--post-match` argument."""
# check the first flag to see what rule
rule = Rule.from_path(known_args.command[0])
rule.post_match(known_args.command[1:])