Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Also mask cmd line option to not show for python 3
  • Loading branch information
manuelseeger committed Jan 8, 2023
commit d5f6c5dbd8eb64a598b0a68cbbde6f2b93996e2f
18 changes: 10 additions & 8 deletions sc2reader/scripts/sc2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,30 @@ def main():
default=None,
help="The per-line indent to use when printing a human readable json string",
)
parser.add_argument(
"--encoding",
"-e",
type=str,
default="UTF-8",
help="The character encoding use..",
)
parser.add_argument(
"path",
metavar="path",
type=str,
nargs=1,
help="Path to the replay to serialize.",
)
if sys.version_info.major < 3:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of #174 Python 2 is no longer supported.

parser.add_argument(
"--encoding",
"-e",
type=str,
default="UTF-8",
help="The character encoding use..",
)

args = parser.parse_args()

factory = sc2reader.factories.SC2Factory()

if sys.version_info.major < 3:
factory.register_plugin(
"Replay", toJSON(encoding=args.encoding, indent=args.indent)
) # legacy Python
)
else:
factory.register_plugin("Replay", toJSON(indent=args.indent))
replay_json = factory.load_replay(args.path[0])
Expand Down