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.

36 lines
702 B
Python

3 years ago
#!/bin/python3
import ddresc_visu.draw as v
from time import sleep
import argparse
3 years ago
3 years ago
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)
3 years ago
ap.add_argument("--start", type=size)
ap.add_argument("--end", type=size)
3 years ago
args = ap.parse_args()
3 years ago
visu = v.Visualisation(args.file, start=args.start, end=args.end)
3 years ago
visu.run(refresh=35)