How can I make it a required argument only if I don't select another option, so when I select version it shouldn't require -f
, but the rest of the time it should be required?
parser = argparse.ArgumentParser(
description="This script will check the uri's from XXX")
parser.add_argument(
"-f", "--file", help="XXX export file to use", required=True)
parser.add_argument("-c", "--check", action="store_true",
help="Check the uri's")
parser.add_argument("-p", "--passwords", action="store_true",
help="Check the weak passwords")
parser.add_argument("-V", "--version", action="store_true",
help="Show version")
self.params = parser.parse_args(self.get_params())