From 6804614d0421b2307060b6e9c83a41b4c502e933 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 4 Jul 2019 11:50:42 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B8=20=D0=B0=D1=80=D0=B3=D1=83=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- py3x/__init__.py | 14 +++++++++++++- py3x/functions.py | 15 +++------------ 2 files changed, 16 insertions(+), 13 deletions(-) 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