Skip to content

Commit 27c355f

Browse files
zachasmeleovp
authored andcommittedJun 2, 2019
Add __main__.py
1 parent e2264d0 commit 27c355f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
 

‎steamfiles/__main__.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from argparse import ArgumentParser
2+
from pprint import PrettyPrinter
3+
4+
from . import acf, appinfo, manifest
5+
6+
parser = ArgumentParser(
7+
prog="steamfiles",
8+
description=" Python library for parsing the most common Steam file formats. ",
9+
)
10+
parser.add_argument(
11+
"type", choices=["acf", "appinfo", "manifest"], help="the type of file"
12+
)
13+
parser.add_argument("file", type=str, help="file to parse")
14+
args = parser.parse_args()
15+
16+
if args.type == "acf":
17+
mode = "r"
18+
module = acf
19+
if args.type == "appinfo":
20+
mode = "rb"
21+
module = appinfo
22+
if args.type == "manifest":
23+
mode = "rb"
24+
module = manifest
25+
26+
pp = PrettyPrinter()
27+
with open(args.file, mode) as f:
28+
data = module.load(f)
29+
pp.pprint(data)

0 commit comments

Comments
 (0)
Please sign in to comment.