33 lines
795 B
Python
33 lines
795 B
Python
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
import argparse
|
|
from blobsend.client_file import FileChunkClient
|
|
|
|
|
|
def cmd_chunks(args, parser):
|
|
c = FileChunkClient(args.fpath)
|
|
for chunk_number, chunk_hash in c.get_hashes():
|
|
print(chunk_number, chunk_hash)
|
|
sys.stdout.flush()
|
|
|
|
|
|
def get_args():
|
|
parser = argparse.ArgumentParser(description="blob copy ssh helper tool")
|
|
sp_action = parser.add_subparsers(dest="action", help="action to take")
|
|
|
|
p_getchunks = sp_action.add_parser("chunks", help="get file chunks")
|
|
p_getchunks.add_argument("fpath", help="file path")
|
|
p_getchunks.set_defaults(function=cmd_chunks)
|
|
|
|
return parser.parse_args(), parser
|
|
|
|
|
|
def main():
|
|
args, parser = get_args()
|
|
args.function(args, parser)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|