event timer
This commit is contained in:
@@ -62,7 +62,10 @@ def parse_speed(speed_string):
|
|||||||
|
|
||||||
|
|
||||||
def parse_options():
|
def parse_options():
|
||||||
parser = argparse.ArgumentParser(description='Transfer time calculator')
|
parser = argparse.ArgumentParser(
|
||||||
|
description = 'Transfer time calculator',
|
||||||
|
epilog = "You may omit the 'b' to time events. ex. '20 minutes / task, 7 tasks to do': %(prog)s 3/h 7"
|
||||||
|
)
|
||||||
parser.add_argument('speed', help = "Speed of transfer (ex. 3.2Mb/s). Time units: s, m, h, d, w")
|
parser.add_argument('speed', help = "Speed of transfer (ex. 3.2Mb/s). Time units: s, m, h, d, w")
|
||||||
parser.add_argument('size', help = "Data size (ex. 4.55GB), or folder/file path. Units: b, kb, mb, gb, tb, pb or kib, mib ... ")
|
parser.add_argument('size', help = "Data size (ex. 4.55GB), or folder/file path. Units: b, kb, mb, gb, tb, pb or kib, mib ... ")
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
@@ -85,7 +88,7 @@ def parse_size(size_string):
|
|||||||
numerical_part = float(numerical_part)
|
numerical_part = float(numerical_part)
|
||||||
multiplier_part = size_string[last_digit:]
|
multiplier_part = size_string[last_digit:]
|
||||||
|
|
||||||
if multiplier_part == "b":
|
if multiplier_part in ("b", ""):
|
||||||
return numerical_part
|
return numerical_part
|
||||||
|
|
||||||
if multiplier_part == "kb":
|
if multiplier_part == "kb":
|
||||||
|
|||||||
Reference in New Issue
Block a user