Ajout de la gestion de dates automatiques

This commit is contained in:
Guyot 2020-04-23 20:30:59 +02:00
parent 74f56e813c
commit 6492573956
1 changed files with 9 additions and 3 deletions

View File

@ -149,7 +149,13 @@ def trace_graph():
for row in contents:
motif = row.split(' ',2)[0]+' '+row.split(' ',2)[1]
if motif == 'set xrange':
contents.insert(linenum, "set xrange ['"+args.dates[0]+"':'"+args.dates[1]+"']\n")
if args.dates[0] == '*':
ligne = "set xrange [*:'"+args.dates[1]+"']\n"
elif args.dates[1] == '*':
ligne = "set xrange ['"+args.dates[0]+"':*]\n"
else:
ligne = "set xrange ['"+args.dates[0]+"':'"+args.dates[1]+"']\n"
contents.insert(linenum, ligne)
del(contents[linenum+1])
linenum += 1
f = open("Fonctionnel.txt", "w")
@ -242,8 +248,8 @@ parser.add_argument('-g', '--graph',
action='store_true'
)
parser.add_argument('-ds', '--dates',
nargs=2,
help=_("optional : date_min date_max ; 'Y-m-d hh:mm:ss'")
nargs='+',
help=_("optional : min_date max_date -> 'Y-m-d hh:mm:ss' or '*' for an automatic date.")
)
parser.add_argument('-tst', '--tests',
help='optional tests operations',