Commit 496c80e1 authored by BorjaEst's avatar BorjaEst
Browse files

Added argparse to main

parent a4f11ed2
......@@ -4,6 +4,6 @@
def hello_world(*arg, **kvarg):
print("Hello World")
if arg or kvarg:
print(f" - Arguments as inputs: {arg}")
print(f" - Key-Value arguments: {kvarg}")
print(f" - Arguments as Inputs: {arg}")
print(f" - Arguments as KeyVal: {kvarg}")
return True
main 100644 → 100755
#!/usr/bin/env python3
"""
Main function description - To show in command help
"""
import sys
import argparse
from cicd import module_template
module_template.hello_world()
def cmdline_args():
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
p.add_argument("non_required_int", nargs='?', type=int,
help="non_required_int description")
p.add_argument("-v", "--verbosity", type=int, choices=[0, 1, 2], default=0,
help="increase output verbosity (default: %(default)s)")
group1 = p.add_mutually_exclusive_group(required=False)
group1.add_argument('--enable', action="store_true")
group1.add_argument('--disable', action="store_false")
return(p.parse_args())
if __name__ == '__main__':
args = cmdline_args()
module_template.hello_world(args, **vars(args))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment