From 2ab98c4090d5523aedcf762c4a54f63067ca1f28 Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Sun, 14 Dec 2014 15:46:01 +0100 Subject: [PATCH] Add -f paramter --- iwla.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/iwla.py b/iwla.py index 81571be..42f5f2c 100755 --- a/iwla.py +++ b/iwla.py @@ -623,6 +623,9 @@ if __name__ == '__main__': default=False, help='Read data from stdin instead of conf.analyzed_filename') + parser.add_argument('-f', '--file', dest='file', + help='Analyse this log file') + args = parser.parse_args() if args.clean_output: @@ -638,8 +641,9 @@ if __name__ == '__main__': if args.stdin: iwla.start(sys.stdin) else: - if not os.path.exists(conf.analyzed_filename): - print 'No such file \'%s\'' % (conf.analyzed_filename) + filename = args.file or conf.analyzed_filename + if not os.path.exists(filename): + print 'No such file \'%s\'' % (filename) sys.exit(-1) - with open(conf.analyzed_filename) as f: + with open(filename) as f: iwla.start(f)