39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
import argparse
|
|
import api
|
|
import mcfs
|
|
|
|
def validate():
|
|
pass
|
|
|
|
def install(projects:list):
|
|
to_install = []
|
|
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))
|
|
|
|
def search():
|
|
pass
|
|
|
|
if __name__ == "__main__":
|
|
desc = '''Minecraft mods packet\
|
|
manager based on modrinth API\n\nMethods:\n install - install mod\n \
|
|
validate - validate mods installation\n search - search mods'''
|
|
parser = argparse.ArgumentParser(description=desc,\
|
|
formatter_class=argparse.RawTextHelpFormatter)
|
|
parser.add_argument("method", choices=['install', 'search', 'validate'],\
|
|
metavar="method")
|
|
parser.add_argument("method_args", nargs="*")
|
|
args = parser.parse_args()
|
|
match args.method:
|
|
case "install":
|
|
pass
|
|
case "search":
|
|
search()
|
|
case "validate":
|
|
validate()
|
|
case _:
|
|
print("Unknown method", args.method)
|
|
parser.print_help()
|