diff --git a/setup.cfg b/setup.cfg index 7fd4e63..2c3f367 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ [metadata] name = paper-secret -version = 0.1.1 +version = 0.1.2 author = Daniel Langbein author_email = daniel@systemli.org description = Shamir Secret Sharing on paper using gfshare diff --git a/src/paper_secret/depaper.py b/src/paper_secret/depaper.py index 17199dd..b699e29 100755 --- a/src/paper_secret/depaper.py +++ b/src/paper_secret/depaper.py @@ -1,15 +1,21 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +import argparse import base64 import tempfile from pathlib import Path -import sys import paper_secret.util as util def main(): - assert len(sys.argv) == 2, 'Expected one argument' - merge_decode(Path(sys.argv[1])) + parser = argparse.ArgumentParser(prog='depaper (paper-secret)') + # + parser.add_argument('src', type=Path, + help='a file with at least k non-empty lines') + # + args = parser.parse_args() + + merge_decode(src=args.src) def merge_decode(src: Path) -> Path: diff --git a/src/paper_secret/enpaper.py b/src/paper_secret/enpaper.py index bca74d0..6227bd2 100755 --- a/src/paper_secret/enpaper.py +++ b/src/paper_secret/enpaper.py @@ -1,15 +1,27 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +import argparse import base64 import tempfile from pathlib import Path -import sys import paper_secret.util as util def main(): - assert len(sys.argv) == 2, 'Expected one argument' - split_encode(Path(sys.argv[1])) + parser = argparse.ArgumentParser(prog='enpaper (paper-secret)') + # + parser.add_argument('secret', type=Path, + help='file containing a secret') + parser.add_argument('--no-qr', '-q', help='skip QR-code generation', + action='store_false', default=True) + parser.add_argument('--no-text-pdf', '-t', help='skip text-PDF generation', + action='store_false', default=True) + # + args = parser.parse_args() + + split_encode(secret=args.secret, + create_qr_codes=args.no_qr, + create_text_pdf=args.no_text_pdf) def split_encode(