rewrite-to-python: flatten structure
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
from .print import pretty_print_marker_data
|
||||
from .validate import validate_marker_data
|
||||
|
||||
from mapcrafter_exporter import generate_mapcrafter_output
|
||||
from bluemap_exporter import generate_bluemap_output
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description="Minecraft map data exporter cli")
|
||||
|
||||
subparsers = parser.add_subparsers(dest="command")
|
||||
|
||||
ebh_parser = subparsers.add_parser(
|
||||
"export-bluemap", help="Export map data to Bluemap format"
|
||||
)
|
||||
ebh_parser.add_argument(
|
||||
"--output-dir",
|
||||
help="Output dir",
|
||||
type=Path,
|
||||
metavar="DIR",
|
||||
default=Path("bluemap"),
|
||||
)
|
||||
|
||||
emj_parser = subparsers.add_parser(
|
||||
"export-mapcrafter", help="Export map data to Mapcrafter format"
|
||||
)
|
||||
emj_parser.add_argument(
|
||||
"--output-dir",
|
||||
help="Output dir",
|
||||
type=Path,
|
||||
metavar="DIR",
|
||||
default=Path("mapcrafter"),
|
||||
)
|
||||
|
||||
subparsers.add_parser("validate", help="Validate the map data")
|
||||
subparsers.add_parser("print", help="Print the map data")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
|
||||
match args.command:
|
||||
case "export-bluemap":
|
||||
generate_bluemap_output(args.output_dir)
|
||||
|
||||
case "export-mapcrafter":
|
||||
generate_mapcrafter_output(args.output_dir)
|
||||
|
||||
case "validate":
|
||||
validate_marker_data()
|
||||
|
||||
case "print":
|
||||
pretty_print_marker_data()
|
||||
|
||||
case _:
|
||||
print("Unknown command")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user