From 9977c523e844c48202c794a0f5a0c2e5a89b2fe9 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Fri, 12 Jan 2018 15:26:17 +0100 Subject: [PATCH] oleobj: accept custom command line args for testing --- oletools/oleobj.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/oletools/oleobj.py b/oletools/oleobj.py index 92669c6..e0f9cf1 100644 --- a/oletools/oleobj.py +++ b/oletools/oleobj.py @@ -667,8 +667,12 @@ def existing_file(filename): return filename -def main(): - """ main function, called when running this as script """ +def main(cmd_line_args=None): + """ main function, called when running this as script + + Per default (cmd_line_args=None) uses sys.argv. For testing, however, can + provide other arguments. + """ # print banner with version print('oleobj %s - http://decalage.info/oletools' % __version__) print('THIS IS WORK IN PROGRESS - Check updates regularly!') @@ -711,7 +715,7 @@ def main(): help='verbose mode, set logging to DEBUG ' '(overwrites -l)') - options = parser.parse_args() + options = parser.parse_args(cmd_line_args) if options.more_input: options.input += [options.more_input, ] if options.verbose: -- libgit2 0.21.4