Initial api realization
This commit is contained in:
parent
f71ac78d70
commit
7e7b46c36b
2 changed files with 63 additions and 4 deletions
16
mc-get.py
16
mc-get.py
|
@ -1,10 +1,18 @@
|
|||
import argparse
|
||||
import api
|
||||
#import urllib.request
|
||||
|
||||
def validate():
|
||||
pass
|
||||
|
||||
def install():
|
||||
pass
|
||||
def install(projects:list):
|
||||
for project in projects:
|
||||
project_data = api.project(project=project)
|
||||
version = api.version(version=project_data.versions[0])
|
||||
file = version.files[0].get("url", "NO URL")
|
||||
print(file)
|
||||
api.download(file, version.files[0].get("size", 0))
|
||||
#urllib.request.urlretrieve(file)
|
||||
|
||||
def search():
|
||||
pass
|
||||
|
@ -17,11 +25,11 @@ validate - validate mods installation\n search - search mods'''
|
|||
formatter_class=argparse.RawTextHelpFormatter)
|
||||
parser.add_argument("method", choices=['install', 'search', 'validate'],\
|
||||
metavar="method")
|
||||
parser.add_argument("--mversion", help="Minecraft version")
|
||||
parser.add_argument("method_args", nargs="*")
|
||||
args = parser.parse_args()
|
||||
match args.method:
|
||||
case "install":
|
||||
install()
|
||||
install(args.method_args)
|
||||
case "search":
|
||||
search()
|
||||
case "validate":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue