From 504136d8edbdf9d9c9f0a224095dab1c7839cb12 Mon Sep 17 00:00:00 2001 From: Kristinn Gudjonsson Date: Mon, 3 Dec 2012 13:25:43 -0800 Subject: [PATCH] Code review: 6879043: Adding a default help message to psort and plaso_information if no options supplied. --- frontend/log2timeline.py | 14 +++++++------- frontend/plaso_information.py | 1 + frontend/psort.py | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/log2timeline.py b/frontend/log2timeline.py index daaa736472..6bea311835 100755 --- a/frontend/log2timeline.py +++ b/frontend/log2timeline.py @@ -130,20 +130,20 @@ options.recursive = os.path.isdir(options.filename) + format_str = '[%(levelname)s] (%(processName)-10s) %(message)s' + if options.debug: + logging.basicConfig(level=logging.DEBUG, format=format_str) + else: + logging.basicConfig(level=logging.INFO, format=format_str) + if not options.output: - print 'Wrong usage: need to define an output.' arg_parser.print_help() + logging.error('Wrong usage: need to define an output.') sys.exit(1) if options.image_offset or options.image_offset_bytes: options.image = True - format_str = '[%(levelname)s] (%(processName)-10s) %(message)s' - if options.debug: - logging.basicConfig(level=logging.DEBUG, format=format_str) - else: - logging.basicConfig(level=logging.INFO, format=format_str) - if options.image: options.preprocess = True diff --git a/frontend/plaso_information.py b/frontend/plaso_information.py index 009cf97a16..731443a14c 100755 --- a/frontend/plaso_information.py +++ b/frontend/plaso_information.py @@ -114,6 +114,7 @@ def DisplayInformation(info, params): options = arg_parser.parse_args() if not options.storage_file: + arg_parser.print_help() logging.error('Not able to run without a storage file being indicated.') sys.exit(1) diff --git a/frontend/psort.py b/frontend/psort.py index 42cdb6358d..bbb0d5dbf9 100755 --- a/frontend/psort.py +++ b/frontend/psort.py @@ -352,7 +352,8 @@ def End(self): sys.exit(0) if not my_args.protofile: - print '-s STORAGEFILE required! or -h for HELP' + parser.print_help() + logging.error('-s STORAGEFILE required! or -h for HELP') sys.exit(0) first, last = GetTimes(my_args)