Command-line interface to process a snapshot and write allocations.json + elements.db to a directory.
()
| 291 | |
| 292 | |
| 293 | def cli(): |
| 294 | """ |
| 295 | Command-line interface to process a snapshot and write allocations.json + elements.db to a directory. |
| 296 | """ |
| 297 | parser = argparse.ArgumentParser() |
| 298 | parser.add_argument("-i", "--input", required=True, type=str, help="Path to snapshot pickle") |
| 299 | parser.add_argument("-o", "--output", required=True, type=str, help="Output directory path") |
| 300 | parser.add_argument("-d", "--device", type=int, default=0, help="Device ID (default=0)") |
| 301 | args = parser.parse_args() |
| 302 | |
| 303 | os.makedirs(args.output, exist_ok=True) |
| 304 | convert_pickle_to_dir(args.input, args.output, args.device) |
| 305 | |
| 306 | print("Done.") |
| 307 | print(f"Output written to: {args.output}") |
| 308 | print(f" {os.path.join(args.output, ALLOCATIONS_FILE_NAME)}") |
| 309 | print(f" {os.path.join(args.output, DATABASE_FILE_NAME)}") |
| 310 | |
| 311 | |
| 312 | if __name__ == "__main__": |
no test coverage detected