diff --git a/edosl0util/cli.py b/edosl0util/cli.py index b676a663e5eda7596bcaa93e1b69d751c86d99c1..ff4b0bcb0d0182e6b3265160b115b5095ebda497 100644 --- a/edosl0util/cli.py +++ b/edosl0util/cli.py @@ -1,7 +1,7 @@ """ Console script entry points for CLI tools. """ -from datetime import datetime +import os from edosl0util import split @@ -10,12 +10,8 @@ def cmd_split(): from argparse import ArgumentParser parser = ArgumentParser(description=split.__doc__) parser.add_argument('--minutes', type=int, default=6) - parser.add_argument('--output-format', default='%y%j%H%M%S001.PDS') parser.add_argument('filepath') args = parser.parse_args() - for time, offset, count, blob in split.split(open(args.filepath), args.minutes): - stamp = datetime.utcfromtimestamp(time) - filepath = stamp.strftime(args.output_format) - print("writing %d packets from offset %d to %s" % (count, offset, filepath)) - open(filepath, 'wb', buffering=0).write(blob) + for stamp, fpath in split.split_file(args.filepath, args.minutes, os.getcwd()): + print('wrote bucket {} to {}'.format(stamp.isoformat(), fpath))