mcserver/register.py
2023-06-17 00:15:24 -04:00

36 lines
1.2 KiB
Python
Executable File

#!/usr/bin/env python3
import os, sys
import typing
from pathlib import Path
XDG_DATA_HOME=os.getenv("XDG_DATA_HOME")
XDG_DATA_HOME=(Path(XDG_DATA_HOME) if XDG_DATA_HOME is not None else
Path('~').expanduser() / ".local/share")
MCSERVER_REGISTRY=XDG_DATA_HOME / "mcserver.json"
def insert_config(name: str, path: typing.Union[str, bytes, os.PathLike]=MCSERVER_REGISTRY):
pass
def remove_config(name: str, path: typing.Union[str, bytes, os.PathLike]=MCSERVER_REGISTRY):
pass
def get_config(name: str, path: typing.Union[str, bytes, os.PathLike]=MCSERVER_REGISTRY):
pass
if __name__ == '__main__':
import argparse
p = argparse.ArgumentParser(description="manage/read mcserver directory list")
p.add_argument("-f", "--file", help="alternative file to use")
subps = p.add_subparsers(help="subcommand", dest="command", required=True)
parser_insert = subps.add_parser("insert", help="insert entry into directory list")
parser_remove = subps.add_parser("remove", help="remove entry from directory list")
parser_get = subps.add_parser("get", help="get entry from directory list")
for name, subp in subps.choices.items():
subp.add_argument("-n", "--name", action="store", required=True)
print(p.parse_args())