Skip to content

Commit

Permalink
Add __main__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
zachasme authored and leovp committed Jun 2, 2019
1 parent e2264d0 commit 27c355f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions steamfiles/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from argparse import ArgumentParser
from pprint import PrettyPrinter

from . import acf, appinfo, manifest

parser = ArgumentParser(
prog="steamfiles",
description=" Python library for parsing the most common Steam file formats. ",
)
parser.add_argument(
"type", choices=["acf", "appinfo", "manifest"], help="the type of file"
)
parser.add_argument("file", type=str, help="file to parse")
args = parser.parse_args()

if args.type == "acf":
mode = "r"
module = acf
if args.type == "appinfo":
mode = "rb"
module = appinfo
if args.type == "manifest":
mode = "rb"
module = manifest

pp = PrettyPrinter()
with open(args.file, mode) as f:
data = module.load(f)
pp.pprint(data)

0 comments on commit 27c355f

Please sign in to comment.