Changeset - 30c60d9d2e94
[Not reviewed]
default
0 2 1
Laman - 3 years ago 2022-03-03 23:19:13

the program can output its version
3 files changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
setup.cfg
Show inline comments
 
[metadata]
 
name = Shamira
 
version = 0.1
 
version = attr: shamira.version.__version__
 
author = Tadeáš Berkman
 
url = https://repo.19x19.cz/Shamira
 
project_urls =
 
    Issue Tracker = https://trac.19x19.cz/shamira/report
 

	
 
[options]
 
packages =
 
    shamira
 
    shamira.tests
 
package_dir =
 
    =src
 
python_requires = >=3.6
 

	
 
[options.entry_points]
 
console_scripts =
 
    shamira = shamira.cli:run
src/shamira/cli.py
Show inline comments
 
# GNU GPLv3, see LICENSE
 

	
 
import sys
 
from argparse import ArgumentParser
 

	
 
from .version import __version__
 
from .core import generate, reconstruct, SException
 
from .benchmark import build_subparsers as build_benchmark
 

	
 

	
 
def run():
 
	parser = ArgumentParser()
 
	parser = ArgumentParser(prog="Shamira")
 
	parser.add_argument("-V", "--version", action="version", version='%(prog)s {}'.format(__version__))
 
	subparsers = parser.add_subparsers()
 

	
 
	build_split_parser(subparsers.add_parser("split"))
 
	build_join_parser(subparsers.add_parser("join"))
 
	build_benchmark(subparsers.add_parser("benchmark"))
 

	
 
	parser.set_defaults(func=lambda _: parser.error("missing command"))
 

	
 
	args = parser.parse_args()
 
	args.func(args)
 

	
 

	
 
def build_split_parser(parser):
 
	parser.add_argument("-k", type=int, required=True, help="number of shares necessary for recovering the secret")
 
	parser.add_argument("-n", type=int, required=True, help="number of generated shares")
 

	
 
	encoding = parser.add_mutually_exclusive_group()
 
	encoding.add_argument("--hex", action="store_true", help="encode shares' bytes as a hexadecimal string")
 
	encoding.add_argument("--b32", action="store_true", help="encode shares' bytes as a base32 string")
 
	encoding.add_argument("--b64", action="store_true", help="encode shares' bytes as a base64 string")
 

	
 
	parser.add_argument("--label", help="any label to prefix the shares with")
 
	parser.add_argument("--omit_k_n", action="store_true", help="suppress the default shares prefix")
 

	
src/shamira/version.py
Show inline comments
 
new file 100644
 
VERSION_TUP = (0, 1)
 
__version__ = ".".join(map(str, VERSION_TUP))
0 comments (0 inline, 0 general)