Updates, ready for 1.1!

This commit is contained in:
oitsjustjose 2021-06-10 23:06:52 -05:00
commit ac6ec6a60e
4 changed files with 35 additions and 20 deletions

View file

@ -14,7 +14,29 @@ The only requirement for using this is Docker. The application is written in Pyt
### Install
After that, download the right executible for you in the [Releases Page](https://github.com/oitsjustjose/DMSM/releases), move it to wherever you keep things (like `/usr/local/bin` for unix-based systems)
An installer has been created for Unix-based users which can be found on the [Releases Page](https://github.com/oitsjustjose/DMSM/releases). Once downloaded, run it as root.
### Usage
**Create**
`dmsm create <SERVER_NAME> -p <PORT> -r <SERVER_ROOT> -v <VERSION> <...OTHER_FLAGS>`
You can find all flags individually detailed (by hand 😓), within [flags.md](https://github.com/oitsjustjose/DMSM/blob/main/flags.md)
**Start**: `dmsm start <SERVER_NAME>`
**Stop**: `dmsm stop <SERVER_NAME> [-f|--force]`
**Restart**: `dmsm restart <SERVER_NAME> [-f|--force]`
**Delete**: `dmsm delete <SERVER_NAME>`
**Status**: `dmsm status <SERVER_NAME>`
**Console**: `dmsm console <SERVER_NAME>`
**Logs**: `dmsm logs <SERVER_NAME>`
## Building
@ -28,4 +50,4 @@ All you have to do once you have the dependencies handled is to run `python3 -m
## Running
The CLI will help you do this -- give me a bit and I'll write up more docs on this!
The CLI will help you do this -- give me a bit and I'll write up more docs on this!

View file

@ -28,9 +28,6 @@ def get_args() -> argparse.Namespace:
if len(sys.argv) >= 2 and sys.argv[1] == "create":
_create(parser)
if len(sys.argv) >= 2 and sys.argv[1] in ["stop", "restart"]:
_stop_restart(parser)
if not _validate(parser):
sys.exit(1)
@ -49,19 +46,6 @@ def _validate(parser: argparse.ArgumentParser) -> bool:
return True
def _stop_restart(parser: argparse.ArgumentParser):
"""
Handles adding the stop/restart arguments
"""
parser.add_argument(
"-f",
"--force",
help="Will forcibly shut down the server",
action="store_true",
required=False,
)
def _create(parser: argparse.ArgumentParser):
"""
Handles adding the create arguments

View file

@ -25,15 +25,17 @@ def main(args: Namespace) -> None:
elif action == "start":
mgr.start_server()
elif action == "stop":
mgr.stop_server(force=args.force)
mgr.stop_server(force="-f" in sys.argv or "--force" in sys.argv)
elif action == "restart":
mgr.restart_server(force=args.force)
mgr.restart_server(force="-f" in sys.argv or "--force" in sys.argv)
elif action == "delete":
mgr.delete_server()
elif action == "status":
mgr.get_status()
elif action == "console":
mgr.open_console()
elif action == "logs":
mgr.logs()
if __name__ == "__main__":

View file

@ -188,4 +188,11 @@ class ServerManager:
"""
Connects the user to the server's console
"""
os.system(f"docker exec -it {self._name} cat logs/latest.log")
os.system(f"docker exec -i {self._name} rcon-cli")
def logs(self):
"""
Shows the latest logs for the server
"""
os.system(f"docker exec -it {self._name} cat logs/latest.log")