Add -f paramter

This commit is contained in:
Gregory Soutade 2014-12-14 15:46:01 +01:00
parent c221c813bf
commit 2ab98c4090

10
iwla.py
View File

@ -623,6 +623,9 @@ if __name__ == '__main__':
default=False, default=False,
help='Read data from stdin instead of conf.analyzed_filename') 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() args = parser.parse_args()
if args.clean_output: if args.clean_output:
@ -638,8 +641,9 @@ if __name__ == '__main__':
if args.stdin: if args.stdin:
iwla.start(sys.stdin) iwla.start(sys.stdin)
else: else:
if not os.path.exists(conf.analyzed_filename): filename = args.file or conf.analyzed_filename
print 'No such file \'%s\'' % (conf.analyzed_filename) if not os.path.exists(filename):
print 'No such file \'%s\'' % (filename)
sys.exit(-1) sys.exit(-1)
with open(conf.analyzed_filename) as f: with open(filename) as f:
iwla.start(f) iwla.start(f)