From 7667022fffbb39d247f9ebdbe45222afcb70c088 Mon Sep 17 00:00:00 2001 From: Tams-Tams Date: Tue, 3 May 2022 16:07:07 +0200 Subject: [PATCH] hi you! --- element_helpers.py | 1 - main.py | 11 ++++------- unittests/testfiles/test1.txt | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/element_helpers.py b/element_helpers.py index cd4d510..c68dadc 100644 --- a/element_helpers.py +++ b/element_helpers.py @@ -27,7 +27,6 @@ def concat(a: str, b: str): """Concat two strings""" return a + b - def interleave(a: list, b: list): """Interleave a and b (two iterables)""" diff --git a/main.py b/main.py index d1c09be..b61fc26 100644 --- a/main.py +++ b/main.py @@ -4,12 +4,9 @@ parser = argparse.ArgumentParser(description="CLI for Excuting Noxan") -# (file name not supported yet) +parser.add_argument("--code", "-c", type=str, help="optional argument to pass code") parser.add_argument( - "--code", "-c", type=str, help="optional argument to pass code/file name" -) -parser.add_argument( - 'filename', nargs="?" + "--file", "-f", type=str, help="optional argument to pass file name" ) @@ -28,8 +25,8 @@ def cli(): args = parser.parse_args() if args.code: print(main(args.code)) - elif args.filename is not None: - main(open(args.filename).readlines()) + elif args.file: + print(main(open(args.file).read())) else: shell() diff --git a/unittests/testfiles/test1.txt b/unittests/testfiles/test1.txt index ebb09dd..eafdfdc 100644 --- a/unittests/testfiles/test1.txt +++ b/unittests/testfiles/test1.txt @@ -1 +1 @@ -+1 1 \ No newline at end of file ++1 -5 ½3 \ No newline at end of file