2024-06-29 15:41:09 +00:00
|
|
|
import argparse
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from .. import __version__
|
2024-07-02 16:09:56 +00:00
|
|
|
from ..models import commands
|
2024-06-29 15:41:09 +00:00
|
|
|
|
2024-07-02 16:09:56 +00:00
|
|
|
# pylint: disable=too-few-public-methods
|
2024-06-29 15:41:09 +00:00
|
|
|
class Arguments(argparse.Namespace):
|
|
|
|
command: str
|
|
|
|
|
2024-07-02 16:09:56 +00:00
|
|
|
# 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)
|
|
|
|
|
2024-06-29 15:41:09 +00:00
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
prog="dockge_cli",
|
|
|
|
description="CLI interface for interacting with Dockge",)
|
|
|
|
|
2024-07-02 16:09:56 +00:00
|
|
|
parser.add_argument("command", choices=list(commands.keys()), action="store", type=str, default=None)
|
2024-06-29 15:41:09 +00:00
|
|
|
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)
|