From 6492573956952781d73c858d3bdf029a0152dab9 Mon Sep 17 00:00:00 2001 From: Guyot Date: Thu, 23 Apr 2020 20:30:59 +0200 Subject: [PATCH] Ajout de la gestion de dates automatiques --- weight-cli.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/weight-cli.py b/weight-cli.py index a9956bb..7811829 100644 --- a/weight-cli.py +++ b/weight-cli.py @@ -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',