import os from pathlib import Path import config import cognos7 import typer app = typer.Typer() cfg = config.Config() @app.command() def iqd_convert(): iqdconv = cognos7.IqdConverter() iqdconv.output_dir = cfg.system_dir + "\\SQL\\schema\\" + cfg.system + "\\views_imr" iqdconv.run_folder(cfg.system_dir + "\\IQD") @app.command() def mdl_convert(mdl_file): cognos7.convert_file(mdl_file) source = mdl_file[:-4] + ".json" target = cfg.cognos11.specs_dir + "/../DataModel/" + Path(source).name os.makedirs(os.path.dirname(target), exist_ok=True) Path(target).unlink(missing_ok=True) os.rename(source, target) if __name__ == "__main__": app()