-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·47 lines (36 loc) · 1.29 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/python3
import sys
import os
import argparse
import config as c
parser = argparse.ArgumentParser()
# TODO: configure should be able to run after the thing has been created
required_args = {
"vultr-token" : "Token to manage vultr servers",
"dropbox-token" : "Token to backup world to dropbox",
"server-link" : "Link to the server zip file",
"server-name" : "server_name to keep dropbox zip files organised",
"start-cmd" : "command to start the server",
}
optional_args = {
"world-link" : "Specify if you don't want to create a new world",
"root-directory": "directory the server will be downloaded in. ~/minecraft by default.",
}
for arg in required_args:
parser.add_argument(arg, help = required_args[arg])
for arg in optional_args:
parser.add_argument("--"+arg, help=optional_args[arg])
parser.add_argument(
"--extract-server",
dest = "extract",
help = "Specify if you downloaded server needs to be unzipped before it can be used",
action = "store_true"
)
parser.set_defaults(extract=False)
args = vars(parser.parse_args())
config = {}
for arg in args:
config[arg] = args[arg]
if not args["root_directory"]:
config["root_directory"] = os.path.join(os.path.expanduser("~"), "minecraft")
c.save_config(config)