in utils/rules_update.py [0:0]
def parsers():
'''
Define the Various Command Line arguments as well as Flags available to the user
Returns:
args: Returns the command line arguments taken from the User
'''
parser = argparse.ArgumentParser()
# Add an argument
template_choices = ['Template1', 'Template2','Template3','Template4',
'Template5','Template6']
parser.add_argument('--template',type=str,
choices=template_choices,
help = "Select One of the available Templates",required=True)
parser.add_argument('--key', type=str,
required=(template_choices[1] not in argv
and '-v' not in argv and '-d' not in argv),
help="Enter the Key Name")
parser.add_argument('--doc_type', type=str,
required=True,
help = "Enter the Document Name")
parser.add_argument('--operator', type=str,
required =((template_choices[2]) in argv) or (template_choices[3] in argv),
help= "Enter one of the Operators")
parser.add_argument('-d','--delete', action='store_true',
help = "Please Enter the doc_type and the Rule_id you wish to remove")
parser.add_argument('-v','--view', action='store_true',
help = "Enter the doctype for which you wish to view the existing rules")
parser.add_argument('--ruleid', type=str,
required = '-d' in argv)
parser.add_argument('--value', type=str,
required=((template_choices[0] not in argv) and
template_choices[1] not in argv and
'-v' not in argv and '-d' not in argv) ,
help = "Enter the Value to compare with the select operators")
parser.add_argument('--value_before', type=int,
required=(template_choices[0] in argv),
help = "Months to subtract from the current date(Only for Template1)")
parser.add_argument('--value_after', type=int,
required=(template_choices[0] in argv),
help="Value in months to add to the current date(Only for Template1)")
parser.add_argument("--key_list", nargs="+",
required=(template_choices[1] in argv),
help = "Enter the keys.(Template 2 only)")
parser.add_argument("--operator_list", nargs="+",
required=(template_choices[1] in argv),
help = "Enter the operators(Template 2 only)")
parser.add_argument("--value_list", nargs="+",
required=(template_choices[1] in argv),
help = " Enter the values(Template 2 only)")
args = parser.parse_args()
return args