dockge-cli/dockge_cli/components/parser.py

29 lines
641 B
Python
Raw Normal View History

2024-06-29 15:41:09 +00:00
import argparse
import sys
from .. import __version__
commands = [
"host",
"login",
"logout",
"list",
"restart",
"update",
"exit"
]
class Arguments(argparse.Namespace):
command: str
parser = argparse.ArgumentParser(
prog="dockge_cli",
description="CLI interface for interacting with Dockge",)
parser.add_argument("command", choices=commands, 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)