aboutsummaryrefslogtreecommitdiff
path: root/modpackman.py
diff options
context:
space:
mode:
authorAlexander Hayden <alexhayden25@gmail.com>2020-11-28 01:38:09 -0500
committerAlexander Hayden <alexhayden25@gmail.com>2020-11-28 01:38:09 -0500
commit82202fea4f29698dddbc3d588e34e4adce26f2f8 (patch)
tree28668576c90ad71de286f1f27254506b1c01fa15 /modpackman.py
parent912d7359c2c01e459b710a4b6b5c53f1a0fae129 (diff)
downloadmodpackman-82202fea4f29698dddbc3d588e34e4adce26f2f8.tar.gz
modpackman-82202fea4f29698dddbc3d588e34e4adce26f2f8.zip
(almost) finish refactor / ini conversion
Diffstat (limited to 'modpackman.py')
-rwxr-xr-xmodpackman.py47
1 files changed, 3 insertions, 44 deletions
diff --git a/modpackman.py b/modpackman.py
index 50c50d2..6e23792 100755
--- a/modpackman.py
+++ b/modpackman.py
@@ -21,25 +21,6 @@ parser.add_argument('command',
nargs='?',
default='install',
help="The action to perform (default: install)")
-parser.add_argument('filename',
- nargs='?',
- default="mods.txt",
- help="Optional filename to specify latest mods (default: mods.txt)")
-parser.add_argument('--version-file',
- type=str,
- default="version.txt",
- help="Optional custom version file to download mods from (default: version.txt)")
-parser.add_argument('--pack-location',
- type=str,
- help="Optional custom modpack folder location (default: read from pack-location.txt)")
-parser.add_argument('--whitelist-file',
- type=str,
- default="whitelist.txt",
- help="Optional custom whitelist file that tells 'install' which files not to remove (default: whitelist.txt)")
-parser.add_argument("--game-version",
- type=str,
- default=None,
- help="The maximum game version to update mods to")
if __name__ == "__main__":
args = parser.parse_args()
@@ -47,35 +28,13 @@ if __name__ == "__main__":
mods = config['mods']
pack = config['pack']
- GAME_VERSION = util.game_version_from_string(pack["game_version"])
- if args.pack_location:
- pack['location'] = args.pack_location
-
- if not os.path.exists(args.version_file):
- print("Error: version file\"" + args.version_file + "\" does not exist.")
- parser.print_help()
- sys.exit(1)
- if args.pack_location and not os.path.exists(args.pack_location):
- print("Error: mod folder \"" + args.pack_location + "\" does not exist.")
- parser.print_help()
- sys.exit(1)
- elif args.pack_location and not os.path.isdir(args.pack_location):
- print("Error: mod folder \"" + args.pack_location + "\" is not actually a folder.")
- parser.print_help()
- sys.exit(1)
- if not os.path.exists(args.whitelist_file):
- print("Error: whitelist file \"" + args.whitelist_file + "\" does not exist.")
- sys.exit(1)
- if args.game_version:
- GAME_VERSION = util.game_version_from_string(args.game_version)
-
# run the command
if args.command == "install":
- util.install(args.version_file, args.whitelist_file, pack['location'])
+ util.install("version.txt", pack["whitelist"], pack['location'])
elif args.command == "apply_updates":
- util.apply_updates(mods, args.version_file, GAME_VERSION)
+ util.apply_updates(mods, "version.txt", pack["game_version"])
elif args.command == "check_updates":
- util.check_updates(mods, args.version_file, GAME_VERSION)
+ util.check_updates(mods, "version.txt", pack["game_version"])
else:
print("Error: command \"" + args.command + "\" does not exist")
parser.print_help()