#!/usr/bin/env python3 import argparse import os import sys import shutil import util parser = argparse.ArgumentParser( description="A Simple Git-Based Modpack Manager", formatter_class=argparse.RawDescriptionHelpFormatter, epilog='''\ Available commands: install : Downloads mods listed in version.txt and populates the mods folder specified in pack-location.txt apply_updates : Using the urls in mods.txt, repopulates version.txt to reflect the most recent mod versions check_updates : Compares version.txt and mods.txt to see if any mods can be updated ''') parser.add_argument('command', nargs='?', default='install', help="The action to perform (default: install)") if __name__ == "__main__": args = parser.parse_args() config = util.load_config() mods = config['mods'] pack = config['pack'] # run the command if args.command == "install": util.install("version.txt", pack["whitelist"], os.path.join(pack['location'], 'mods')) elif args.command == "apply_updates": util.apply_updates(mods, "version.txt", pack["game_version"]) elif args.command == "check_updates": util.check_updates(mods, "version.txt", pack["game_version"]) else: print("Error: command \"" + args.command + "\" does not exist") parser.print_help() sys.exit(1)