Skip to content

Commit 3bfbd20

Browse files
committed
Cli: update
1 parent fd9b17a commit 3bfbd20

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/qapy/cli.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,27 @@ def main():
3030

3131
parser_compile = subparsers.add_parser("compile", help="compile the source code", description="Compile the source code and write the constraints, witness generation functions, and public entry names to files.")
3232
parser_compile.add_argument("file", type=str, help="path to the source code")
33-
parser_compile.add_argument("-g", "--gates", type=str, default=None, help="path to write the constraints to (default: a.gates)")
34-
parser_compile.add_argument("-f", "--funcs", type=str, default=None, help="path to write the witness generation functions to (default: a.funcs)")
35-
parser_compile.add_argument("-n", "--names", type=str, default=None, help="path to write the public entry names to (default: a.names)")
33+
parser_compile.add_argument("-g", "--gates", type=str, default=None, help="path to write the constraints to (skipped if not given)")
34+
parser_compile.add_argument("-f", "--funcs", type=str, default=None, help="path to write the witness generation functions to (skipped if not given)")
35+
parser_compile.add_argument("-n", "--names", type=str, default=None, help="path to write the public entry names to (skipped if not given)")
3636

3737
parser_setup = subparsers.add_parser("setup", help="set up the parameters", description="Set up the parameters for proving and verifying and write them to files.")
3838
parser_setup.add_argument("file", type=str, nargs="?", help="path to the source code")
39-
parser_setup.add_argument("-g", "--gates", type=str, default=None, help="path to read the constraints from (default: a.gates)")
39+
parser_setup.add_argument("-g", "--gates", type=str, default=None, help="path to read the constraints from (required if source code is not given)")
4040
parser_setup.add_argument("-p", "--pk", type=str, default="a.pk", help="path to write the parameters for proving to (default: a.pk)")
4141
parser_setup.add_argument("-v", "--vk", type=str, default="a.vk", help="path to write the parameters for verifying to (default: a.vk)")
4242

4343
parser_prove = subparsers.add_parser("prove", help="generate a proof", description="Generate a proof and write it to a file")
4444
parser_prove.add_argument("file", type=str, nargs="?", help="path to the source code")
45-
parser_prove.add_argument("-g", "--gates", type=str, default=None, help="path to read the constraints from (default: a.gates)")
46-
parser_prove.add_argument("-f", "--funcs", type=str, default=None, help="path to read the witness generation functions from (default: a.funcs)")
45+
parser_prove.add_argument("-g", "--gates", type=str, default=None, help="path to read the constraints from (required if source code is not given)")
46+
parser_prove.add_argument("-f", "--funcs", type=str, default=None, help="path to read the witness generation functions from (required if source code is not given)")
4747
parser_prove.add_argument("-p", "--pk", type=str, default="a.pk", help="path to read the parameters for proving from (default: a.pk)")
4848
parser_prove.add_argument("-a", "--args", action=StoreKVPairs, nargs="*", default={}, help="the arguments to the program as key=value pairs")
4949
parser_prove.add_argument("-P", "--proof", type=str, default="a.proof", help="path to write the proof to (default: a.proof)")
5050

5151
parser_verify = subparsers.add_parser("verify", help="verify a proof", description="Verify a proof")
5252
parser_verify.add_argument("file", type=str, nargs="?", help="path to the source code")
53-
parser_verify.add_argument("-n", "--names", type=str, default=None, help="path to read the public entry names from (default: a.names)")
53+
parser_verify.add_argument("-n", "--names", type=str, default=None, help="path to read the public entry names from (required if source code is not given)")
5454
parser_verify.add_argument("-v", "--vk", type=str, default="a.vk", help="path to read the parameters for verifying from (default: a.vk)")
5555
parser_verify.add_argument("-P", "--proof", type=str, default="a.proof", help="path to read the proof from (default: a.proof)")
5656

@@ -100,7 +100,7 @@ def main():
100100
print("Loading constraints from:", args.gates)
101101
wire_count, skeys, gates = dill.loads(gates_file.read())
102102
else:
103-
raise ValueError("--gates must be provided for setup if source code is not given.")
103+
raise parser_setup.error("--gates must be provided for setup if source code is not given.")
104104

105105
print("Setting up parameters for proving and verifying...")
106106
key = setup(wire_count, skeys, gates)
@@ -133,7 +133,7 @@ def main():
133133
print("Loading witness generation functions from:", args.funcs)
134134
funcs = dill.loads(funcs_file.read())
135135
else:
136-
raise ValueError("--gates and --funcs must be provided for proving if source code is not given.")
136+
raise parser_prove.error("--gates and --funcs must be provided for proving if source code is not given.")
137137

138138
with open(args.pk, "rb") as pk_file:
139139
print("Loading parameters for proving from:", args.pk)
@@ -161,7 +161,7 @@ def main():
161161
print("Loading public entry names from:", args.names)
162162
names = dill.loads(names_file.read())
163163
else:
164-
raise ValueError("--names must be provided for verifying if source code is not given.")
164+
raise parser_verify.error("--names must be provided for verifying if source code is not given.")
165165

166166
with open(args.vk, "rb") as vk_file:
167167
print("Loading parameters for verifying from:", args.vk)

0 commit comments

Comments
 (0)