def make_parser(): """ Takes ArgParse instance with default arguments and adds Positional Arguments: * module_name Flags: * -n (no-import) * -f (fullname) Returns: :class:`argparse.ArgumentParser`: ArgParse instance """ supported_areas = ["support", "ioc", "python", "python3", "tools"] parser = ArgParser(usage, supported_areas) parser.add_module_name_arg() parser.formatter_class = argparse.RawDescriptionHelpFormatter # The following arguments cannot be used together group = parser.add_mutually_exclusive_group() group.add_argument( "-n", "--no-import", action="store_true", dest="no_import", help="Creates the module but doesn't store it on the server") group.add_argument( "-e", "--empty", action="store_true", dest="empty", help="Initialize an empty remote repository on the server. Does not " "create a local repo nor commit any files.") parser.add_argument( "-q", "--ignore_existing", action="store_true", dest="ignore_existing", help="When used together with -e/--empty, this script will exit " "silently with success if a repository with the given name " "already exists on the server.") return parser
def make_parser(): """ Takes ArgParse instance with default arguments and adds Positional Arguments: * modules Flags: * -c (contact) * -d (cc) * -s (csv) * -m (import) Returns: :class:`argparse.ArgumentParser`: ArgParse instance """ parser = ArgParser(usage) parser.formatter_class = argparse.RawDescriptionHelpFormatter # nargs='*' makes <modules> an optional positional argument; a list of N # entries parser.add_argument( "modules", nargs='*', type=str, default=None, help="Name(s) of module(s) to list/set contacts for") parser.add_argument( "-c", "--contact", action="store", type=str, metavar="FED_ID", dest="contact", help="Set the contact property to FED_ID") parser.add_argument( "-d", "--cc", action="store", type=str, metavar="FED_ID", dest="cc", help="Set the cc property to FED_ID") parser.add_argument( "-s", "--csv", action="store_true", dest="csv", help="Print output as csv file") parser.add_argument( "-m", "--import", action="store", type=str, metavar="CSV_FILE", dest="imp", help="Import a CSV_FILE with header and rows of format:" + "\nModule, Contact, Contact Name, CC, CC Name") return parser