Add -f paramter

This commit is contained in:
Gregory Soutade 2014-12-14 15:46:01 +01:00
parent c221c813bf
commit 2ab98c4090
1 changed files with 7 additions and 3 deletions

10
iwla.py
View File

@ -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)