Restructure: remove separate parser
This commit is contained in:
@@ -3,23 +3,25 @@
|
||||
from argparse import ArgumentParser
|
||||
from pathlib import Path
|
||||
|
||||
from ergogen_footprint_converter.parser import Parser
|
||||
from ergogen_footprint_converter.converter import Converter
|
||||
from .converter import Converter
|
||||
|
||||
from kiutils.footprint import Footprint
|
||||
|
||||
|
||||
def main (args) -> None:
|
||||
check_args(args)
|
||||
|
||||
in_file: Path = args["in_file"]
|
||||
out_dir: Path = args["out"]
|
||||
converted = convert(args["in_file"])
|
||||
|
||||
parser = Parser(in_file)
|
||||
parsed = parser.parse()
|
||||
write_output(converted, args["in_file"], args["out"])
|
||||
|
||||
def convert(in_file: Path) -> str:
|
||||
parsed = Footprint.from_file(in_file.absolute().__str__())
|
||||
|
||||
converter = Converter(parsed)
|
||||
converted = converter.convert()
|
||||
|
||||
write_output(converted, in_file, out_dir)
|
||||
return converter.convert()
|
||||
|
||||
|
||||
def write_output (output: str, in_file: Path, out_dir: Path) -> None:
|
||||
filename = in_file.name
|
||||
|
||||
Reference in New Issue
Block a user