summaryrefslogtreecommitdiff
path: root/cmd2/plugin.py
blob: f9f5c573cb08567fc45f5cb32372b2f9aa0c4f3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#
# coding=utf-8
"""Classes for the cmd2 plugin system"""
from typing import (
    Optional,
)

import attr

from .parsing import (
    Statement,
)


@attr.s(auto_attribs=True)
class PostparsingData:
    """Data class containing information passed to postparsing hook methods"""

    stop: bool
    statement: Statement


@attr.s(auto_attribs=True)
class PrecommandData:
    """Data class containing information passed to precommand hook methods"""

    statement: Statement


@attr.s(auto_attribs=True)
class PostcommandData:
    """Data class containing information passed to postcommand hook methods"""

    stop: bool
    statement: Statement


@attr.s(auto_attribs=True)
class CommandFinalizationData:
    """Data class containing information passed to command finalization hook methods"""

    stop: bool
    statement: Optional[Statement]