diff --git a/scripts/vm.py b/scripts/vm.py index f0537db9..3cd047d3 100755 --- a/scripts/vm.py +++ b/scripts/vm.py @@ -1,10 +1,12 @@ #!/usr/bin/env python3 +import argparse import copy import json import re import subprocess from enum import Enum as PyEnum +from pathlib import Path from typing import Callable from urllib import request @@ -26,7 +28,16 @@ def main(): - json_str = request.urlopen(CHEATCODES_JSON_URL).read().decode("utf-8") + parser = argparse.ArgumentParser( + description="Generate Vm.sol based on the cheatcodes json created by Foundry") + parser.add_argument( + "--from", + metavar="PATH", + dest="path", + required=False, + help="path to a json file containing the Vm interface, as generated by Foundry") + args = parser.parse_args() + json_str = request.urlopen(CHEATCODES_JSON_URL).read().decode("utf-8") if args.path is None else Path(args.path).read_text() contract = Cheatcodes.from_json(json_str) ccs = contract.cheatcodes