Implement --fingerprint option for manual fingerprint checking
This commit is contained in:
parent
7de587148e
commit
3179be1f76
7
main.py
7
main.py
@ -28,6 +28,10 @@ BUF_SIZE = 65536 # Linux default pipe capacity is 64KiB (64 * 2^10)
|
|||||||
'--file', '-f', default=None, type=click.Path(exists=True),
|
'--file', '-f', default=None, type=click.Path(exists=True),
|
||||||
help='Calculate from file or directory (recursive).'
|
help='Calculate from file or directory (recursive).'
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
'--fingerprint', '-p', default=False, required=False, is_flag=True,
|
||||||
|
help='Print fingerprint instead of identicon.'
|
||||||
|
)
|
||||||
def main(**kwargs):
|
def main(**kwargs):
|
||||||
if not (stream := get_input_stream(kwargs)):
|
if not (stream := get_input_stream(kwargs)):
|
||||||
print_usage_and_exit()
|
print_usage_and_exit()
|
||||||
@ -35,9 +39,12 @@ def main(**kwargs):
|
|||||||
digest = get_digest(stream.stream)
|
digest = get_digest(stream.stream)
|
||||||
stream.close()
|
stream.close()
|
||||||
|
|
||||||
|
if not kwargs.get('fingerprint'):
|
||||||
i = Identicon(digest)
|
i = Identicon(digest)
|
||||||
i.calculate()
|
i.calculate()
|
||||||
print(i)
|
print(i)
|
||||||
|
else:
|
||||||
|
print(digest.hex())
|
||||||
|
|
||||||
|
|
||||||
def get_input_stream(kwargs):
|
def get_input_stream(kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user