mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 01:28:56 +00:00
#N/A Add initial support to the --post-match
arg
This commit is contained in:
parent
db488d35eb
commit
90afdb04ba
@ -50,6 +50,10 @@ class Parser(object):
|
|||||||
'command',
|
'command',
|
||||||
nargs='*',
|
nargs='*',
|
||||||
help='command that should be fixed')
|
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):
|
def _add_conflicting_arguments(self):
|
||||||
"""It's too dangerous to use `-y` and `-r` together."""
|
"""It's too dangerous to use `-y` and `-r` together."""
|
||||||
|
@ -11,6 +11,7 @@ from ..utils import get_installation_info # noqa: E402
|
|||||||
from ..shells import shell # noqa: E402
|
from ..shells import shell # noqa: E402
|
||||||
from .alias import print_alias # noqa: E402
|
from .alias import print_alias # noqa: E402
|
||||||
from .fix_command import fix_command # noqa: E402
|
from .fix_command import fix_command # noqa: E402
|
||||||
|
from .post_match_execute import post_match_execute # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -22,6 +23,9 @@ def main():
|
|||||||
elif known_args.version:
|
elif known_args.version:
|
||||||
logs.version(get_installation_info().version,
|
logs.version(get_installation_info().version,
|
||||||
sys.version.split()[0], shell.info())
|
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:
|
elif known_args.command or 'TF_HISTORY' in os.environ:
|
||||||
fix_command(known_args)
|
fix_command(known_args)
|
||||||
elif known_args.alias:
|
elif known_args.alias:
|
||||||
|
9
thefuck/entrypoints/post_match_execute.py
Normal file
9
thefuck/entrypoints/post_match_execute.py
Normal 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:])
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user