Skip to content

Commit

Permalink
doc(py): Better argparse for yao.py
Browse files Browse the repository at this point in the history
  • Loading branch information
vEnhance committed Aug 13, 2024
1 parent dd5f347 commit 207a1fb
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions py-scripts/yao.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,24 @@ def generate_key_pair(bits):
return (e, d, n)


parser = argparse.ArgumentParser("yao", description="Run millionaire problem.")
parser.add_argument("salary", nargs="?", type=int, default=None)
parser = argparse.ArgumentParser(
"yao",
description="A silly implementation of Yao's millionaire problems to use with friends.",
)
parser.add_argument(
"salary",
nargs="?",
type=int,
default=None,
help="The salary you are hiding from your friend. "
"If not specified, will be read from a prompt (with echo disabled).",
)
parser.add_argument(
"-n", "--nocache", action="store_true", help="Don't save the RSA key."
)
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("--alice", action="store_true", help="Specify you are Alice")
group.add_argument("--bob", action="store_true", help="Specify you are Bob")
group.add_argument("-a", "--alice", action="store_true", help="Specify you are Alice")
group.add_argument("-b", "--bob", action="store_true", help="Specify you are Bob")

opts = parser.parse_args()

Expand Down

0 comments on commit 207a1fb

Please sign in to comment.