29 lines
937 B
Python
29 lines
937 B
Python
# Copyright 2023 (c) Anna Schumaker
|
|
"""Implements the toplevel xfstestsdb command."""
|
|
import argparse
|
|
|
|
MAJOR = 1
|
|
MINOR = 0
|
|
|
|
|
|
class Command:
|
|
"""The root xfstestsdb command."""
|
|
|
|
def __init__(self) -> None:
|
|
"""Initialize the xfstestsdb command."""
|
|
self.parser = argparse.ArgumentParser()
|
|
self.parser.set_defaults(function=lambda x: self.parser.print_usage())
|
|
self.parser.add_argument("--version", action="store_true",
|
|
help="show version number and exit")
|
|
self.subparser = self.parser.add_subparsers(title="commands")
|
|
self.commands = {}
|
|
|
|
def run(self, args: list = None) -> None:
|
|
"""Run the xfstestsdb command."""
|
|
parsed = self.parser.parse_args(args)
|
|
if parsed.version:
|
|
print(f"xfstestsdb v{MAJOR}.{MINOR}"
|
|
f"{'-debug' if __debug__ else ''}")
|
|
else:
|
|
parsed.function(parsed)
|