diff --git a/py3x/__init__.py b/py3x/__init__.py index ced3179..822bb71 100644 --- a/py3x/__init__.py +++ b/py3x/__init__.py @@ -1,9 +1,21 @@ print("loading py3x/__init__.py") +import sys from py3x.functions import parse_args def main(): """ Main function """ print("running function main from py3x/__init__.py") - parse_args() + args = parse_args(sys.argv[1:]) + + if args.verbose: + if args.input: + print("input file name is: {}".format(args.input)) + if args.output: + print("output file name is: {}".format(args.output)) + else: + if args.input: + print(args.input) + if args.output: + print(args.output) diff --git a/py3x/functions.py b/py3x/functions.py index 1981020..eeae6e2 100644 --- a/py3x/functions.py +++ b/py3x/functions.py @@ -2,7 +2,7 @@ print("loading py3x/functions.py") import argparse -def parse_args(): +def parse_args(args): """ Parse command line arguments """ print("running function parse_args from py3x/functions.py") @@ -13,15 +13,6 @@ def parse_args(): help="Output file name") parser.add_argument("-v", "--verbose", action="store_true", help="Increase output verbosity") - args = parser.parse_args() - if args.verbose: - if args.input: - print("input file name is: {}".format(args.input)) - if args.output: - print("output file name is: {}".format(args.output)) - else: - if args.input: - print(args.input) - if args.output: - print(args.output) + args = parser.parse_args(args) + return args