diff options
author | Arun Isaac | 2025-09-04 19:58:15 +0100 |
---|---|---|
committer | Arun Isaac | 2025-09-04 19:59:58 +0100 |
commit | d94e8b06e2e11374a074cca02a71c4ba358be172 (patch) | |
tree | f11e43a1e7f5ee5cebe6537cec65f2bb7023f7f0 | |
parent | 7d9d55e571b562a8d8faaee100c2ae075034a91d (diff) | |
download | pyhegp-d94e8b06e2e11374a074cca02a71c4ba358be172.tar.gz pyhegp-d94e8b06e2e11374a074cca02a71c4ba358be172.tar.lz pyhegp-d94e8b06e2e11374a074cca02a71c4ba358be172.zip |
Add --force flag to encrypt subcommand permitting file overwriting.
-rw-r--r-- | pyhegp/pyhegp.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pyhegp/pyhegp.py b/pyhegp/pyhegp.py index b4c1f2e..7959841 100644 --- a/pyhegp/pyhegp.py +++ b/pyhegp/pyhegp.py @@ -185,10 +185,12 @@ def pool_command(pooled_summary_file, summary_files): help="Summary statistics file") @click.option("--key", "-k", "key_file", type=click.File("w"), help="Output key") -def encrypt_command(genotype_file, phenotype_file, summary_file, key_file): +@click.option("--force", "-f", is_flag=True, + help="Overwrite output files even if they exist") +def encrypt_command(genotype_file, phenotype_file, summary_file, key_file, force): def write_ciphertext(plaintext_path, writer): ciphertext_path = Path(plaintext_path + ".hegp") - if ciphertext_path.exists(): + if ciphertext_path.exists() and not force: print(f"Output file {ciphertext_path} exists, cannot overwrite.") sys.exit(1) with ciphertext_path.open("w") as ciphertext_file: |