29 lines
641 B
Python
29 lines
641 B
Python
|
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)
|