You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
700 B
Python

#!/bin/python3
import ddresc_visu.draw as v
from time import sleep
import argparse
def size(string):
string = string.strip().casefold()
units = ['', 'k', 'm', 'g', 't']
try:
result = int(string, base=0)
return result
except ValueError:
pass
letter = string[-1]
if letter in units:
idx = units.index(letter)
string = string[:-1]
result = int(string, base=0) * 1000 ** idx
return result
raise ValueError("Not a valid size.")
ap = argparse.ArgumentParser()
ap.add_argument('file', type=str)
ap.add_argument("--start", type=size)
ap.add_argument("--end", type=size)
args = ap.parse_args()
visu = v.Visualisation(args.file, start=args.start, end=args.end)
visu.run(refresh=35)