# Buggy code
def init_subparser(cli):
    """Initializes the parser for convert-specific args."""
    cli.set_defaults(entrypoint=main)

    cli.add_argument("--source-dir", default=None, help="source data directory")

    cli.add_argument(
        "--force",
        action="store_true",
        help="force conversion, even if up-to-date assets already exist.",
    )

    cli.add_argument(
        "--gen-extra-files",
        action="store_true",
        help="generate some extra files, useful for debugging the converter.",
    )

    cli.add_argument(
        "--no-media",
        action="store_true",
        help="do not convert any media files (slp, wav, ...)",
    )

    cli.add_argument(
        "--no-metadata",
        action="store_true",
        help=(
            "do not store any metadata (except for those associated with media files)"
        ),
    )

    cli.add_argument(
        "--no-sounds", action="store_true", help="do not convert any sound files"
    )

    cli.add_argument(
        "--no-graphics", action="store_true", help="do not convert game graphics"
    )

    cli.add_argument(
        "--no-interface", action="store_true", help="do not convert interface graphics"
    )

    cli.add_argument(
        "--no-scripts",
        action="store_true",
        help="do not convert scripts (AI and Random Maps)",
    )

    cli.add_argument(
        "--no-pickle-cache",
        action="store_true",
        help="don't use a pickle file to skip the dat file reading.",
    )

    cli.add_argument("--jobs", "-j", type=int, default=None)

    cli.add_argument(
        "--interactive",
        "-i",
        action="store_true",
        help="browse the files interactively",
    )

    cli.add_argument(
        "--id",
        type=int,
        default=None,
        help="only convert files with this id (used for debugging..)",
    )


# Traceback (ValueError)
dev@openage:~/openage$ python3 -m openage convert-file /home/dev/aoe1/data/Border.drs 20000.slp /home/dev/aoe1/data/test.png
INFO opening slp in drs '/home/dev/aoe1/data/Border.drs:20000.slp'...
INFO parsing slp image...
INFO opening palette in drs '/home/dev/aoe1/data/interfac.drs:50500.bin'...
INFO parsing palette data...
INFO packing texture...
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/dev/openage/openage/__main__.py", line 128, in <module>
exit(main())
File "/home/dev/openage/openage/__main__.py", line 121, in main
return args.entrypoint(args, cli.error)
File "/home/dev/openage/openage/convert/singlefile.py", line 72, in main
tex.save(Directory(path).root, filename)
File "/home/dev/openage/openage/convert/texture.py", line 170, in save
raise ValueError("Texture must be saved as name.png. got: %s" % filename)
ValueError: Texture must be saved as name.png. got: test

# Fixed code
def init_subparser(cli):
    """Initializes the parser for convert-specific args."""
    cli.set_defaults(entrypoint=main)

    cli.add_argument("--source-dir", default=None, help="source data directory")

    cli.add_argument(
        "--output-dir", default=None, help="destination data output directory"
    )

    cli.add_argument(
        "--force",
        action="store_true",
        help="force conversion, even if up-to-date assets already exist.",
    )

    cli.add_argument(
        "--gen-extra-files",
        action="store_true",
        help="generate some extra files, useful for debugging the converter.",
    )

    cli.add_argument(
        "--no-media",
        action="store_true",
        help="do not convert any media files (slp, wav, ...)",
    )

    cli.add_argument(
        "--no-metadata",
        action="store_true",
        help=(
            "do not store any metadata (except for those associated with media files)"
        ),
    )

    cli.add_argument(
        "--no-sounds", action="store_true", help="do not convert any sound files"
    )

    cli.add_argument(
        "--no-graphics", action="store_true", help="do not convert game graphics"
    )

    cli.add_argument(
        "--no-interface", action="store_true", help="do not convert interface graphics"
    )

    cli.add_argument(
        "--no-scripts",
        action="store_true",
        help="do not convert scripts (AI and Random Maps)",
    )

    cli.add_argument(
        "--no-pickle-cache",
        action="store_true",
        help="don't use a pickle file to skip the dat file reading.",
    )

    cli.add_argument("--jobs", "-j", type=int, default=None)

    cli.add_argument(
        "--interactive",
        "-i",
        action="store_true",
        help="browse the files interactively",
    )

    cli.add_argument(
        "--id",
        type=int,
        default=None,
        help="only convert files with this id (used for debugging..)",
    )