32 lines
1 KiB
Python
32 lines
1 KiB
Python
import argparse
|
|
import sys
|
|
|
|
from .. import __version__
|
|
from ..models import commands
|
|
|
|
# pylint: disable=too-few-public-methods
|
|
class Arguments(argparse.Namespace):
|
|
command: str
|
|
|
|
# pylint: disable=too-few-public-methods
|
|
class Credentials(argparse.Namespace):
|
|
username: str
|
|
password: str
|
|
|
|
credentialparser = argparse.ArgumentParser(
|
|
prog="login",
|
|
description="Subparser for login credentials provided by CI"
|
|
)
|
|
credentialparser.add_argument("--username", action="store", type=str, required=True)
|
|
credentialparser.add_argument("--password", action="store", type=str, required=True)
|
|
|
|
parser = argparse.ArgumentParser(
|
|
prog="dockge_cli",
|
|
description="CLI interface for interacting with Dockge",)
|
|
|
|
parser.add_argument("command", choices=list(commands.keys()), action="store", type=str, default=None)
|
|
parser.add_argument("--version", action="version", version=f"dockge_cli {__version__}")
|
|
|
|
args = Arguments()
|
|
args, extra_args = parser.parse_known_args(sys.argv[1:], namespace=args)
|