mirror of
https://codeberg.org/privacy1st/paper-secret
synced 2024-12-22 23:56:05 +01:00
argparse
This commit is contained in:
parent
c2f292bd5b
commit
e4f63e8971
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
name = paper-secret
|
name = paper-secret
|
||||||
version = 0.1.1
|
version = 0.1.2
|
||||||
author = Daniel Langbein
|
author = Daniel Langbein
|
||||||
author_email = daniel@systemli.org
|
author_email = daniel@systemli.org
|
||||||
description = Shamir Secret Sharing on paper using gfshare
|
description = Shamir Secret Sharing on paper using gfshare
|
||||||
|
@ -1,15 +1,21 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import argparse
|
||||||
import base64
|
import base64
|
||||||
import tempfile
|
import tempfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
|
||||||
import paper_secret.util as util
|
import paper_secret.util as util
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
assert len(sys.argv) == 2, 'Expected one argument'
|
parser = argparse.ArgumentParser(prog='depaper (paper-secret)')
|
||||||
merge_decode(Path(sys.argv[1]))
|
#
|
||||||
|
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:
|
def merge_decode(src: Path) -> Path:
|
||||||
|
@ -1,15 +1,27 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import argparse
|
||||||
import base64
|
import base64
|
||||||
import tempfile
|
import tempfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
|
||||||
import paper_secret.util as util
|
import paper_secret.util as util
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
assert len(sys.argv) == 2, 'Expected one argument'
|
parser = argparse.ArgumentParser(prog='enpaper (paper-secret)')
|
||||||
split_encode(Path(sys.argv[1]))
|
#
|
||||||
|
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(
|
def split_encode(
|
||||||
|
Loading…
Reference in New Issue
Block a user