2024-06-29 15:41:09 +00:00
|
|
|
import argparse
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from .. import __version__
|
2024-07-03 18:36:22 +00:00
|
|
|
from ..models.parser import Arguments
|
2024-07-04 20:12:36 +00:00
|
|
|
from .commandprovider.factory import commands
|
2024-06-29 15:41:09 +00:00
|
|
|
|
2024-07-03 18:36:22 +00:00
|
|
|
def parse_arguments():
|
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
prog="dockge_cli",
|
|
|
|
description="CLI interface for interacting with Dockge",)
|
2024-06-29 15:41:09 +00:00
|
|
|
|
2024-07-04 20:12:36 +00:00
|
|
|
parser.add_argument("command", choices=list(commands.keys()), action="store", type=str, default=None)
|
2024-07-03 18:36:22 +00:00
|
|
|
parser.add_argument("--version", action="version", version=f"dockge_cli {__version__}")
|
2024-07-02 16:09:56 +00:00
|
|
|
|
2024-07-03 18:36:22 +00:00
|
|
|
args = Arguments()
|
|
|
|
args, extra_args = parser.parse_known_args(sys.argv[1:], namespace=args)
|
|
|
|
return args, extra_args
|