~brenns10/subc

450e227f4a035debef297c484540e1bd0cbd0fa7 — Stephen Brennan 2 years ago 4442027
Add main() helper
1 files changed, 8 insertions(+), 0 deletions(-)

M subc.py
M subc.py => subc.py +8 -0
@@ 83,3 83,11 @@ class Command(ABC):
            raise Exception('you must select a sub-command')
        parser.set_defaults(func=default)
        return parser

    @classmethod
    def main(cls, description):
        # type: (str) -> None
        parser = argparse.ArgumentParser(description=description)
        cls.add_commands(parser)
        args = parser.parse_args()
        args.func(args)