From 6ef29fd62088de712da31354bb8e8034db6e5106 Mon Sep 17 00:00:00 2001 From: syrell Date: Sun, 1 Dec 2024 21:31:29 +0100 Subject: [PATCH] feat: Added exercise 1 and 2 --- ex1/a.py | 9 +++++++++ ex1/b.py | 13 +++++++++++++ ex1/c.py | 10 ++++++++++ ex2/Dockerfile | 3 +++ 4 files changed, 35 insertions(+) create mode 100644 ex1/a.py create mode 100644 ex1/b.py create mode 100644 ex1/c.py create mode 100644 ex2/Dockerfile diff --git a/ex1/a.py b/ex1/a.py new file mode 100644 index 0000000..bc2b1cc --- /dev/null +++ b/ex1/a.py @@ -0,0 +1,9 @@ +import sys + + +def print_args(): + return " ".join(sys.argv[1:]) + + +if __name__ == "__main__": + print(print_args()) \ No newline at end of file diff --git a/ex1/b.py b/ex1/b.py new file mode 100644 index 0000000..9757e0d --- /dev/null +++ b/ex1/b.py @@ -0,0 +1,13 @@ +import argparse +import sys + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("-t", "--target", choices=["titi", "toto", "tata"]) + args = parser.parse_args() + return args.target + + +if __name__ == "__main__": + print(main()) \ No newline at end of file diff --git a/ex1/c.py b/ex1/c.py new file mode 100644 index 0000000..715689f --- /dev/null +++ b/ex1/c.py @@ -0,0 +1,10 @@ +from a import print_args +from art import text2art + + +def main(): + return text2art(print_args()) + + +if __name__ == "__main__": + print(main()) diff --git a/ex2/Dockerfile b/ex2/Dockerfile new file mode 100644 index 0000000..44ae8ea --- /dev/null +++ b/ex2/Dockerfile @@ -0,0 +1,3 @@ +FROM scratch +COPY app / +CMD ["/app"] \ No newline at end of file