parent_parser = argparse.ArgumentParser(add_help=False)
main_parser = argparse.ArgumentParser(prog='app_cli')
service_subparsers = main_parser.add_subparsers(title="service", dest="service_command", )
service_parser = service_subparsers.add_parser("-dr", help="sample help", parents=[parent_parser])
service_parser.add_argument("-old_host",help="my old host", dest="oldHost", required=False)
args = main_parser.parse_args()
when I try to run the app_cli -dr I am getting an error "error:unrecognized arguments: -dr"
when I try to run the app_cli with -dr -h I am getting the help of the main application and not the help of the service subparser
only if I change '-dr' to 'dr' it works as expected, but I need to support the hyphen for all arguments |