This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nir_barel@bmc.com
Recipients nir_barel@bmc.com
Date 2018-07-04.16:19:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1530721199.23.0.56676864532.issue34046@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2018-07-04 16:19:59nir_barel@bmc.comsetrecipients: + nir_barel@bmc.com
2018-07-04 16:19:59nir_barel@bmc.comsetmessageid: <1530721199.23.0.56676864532.issue34046@psf.upfronthosting.co.za>
2018-07-04 16:19:59nir_barel@bmc.comlinkissue34046 messages
2018-07-04 16:19:59nir_barel@bmc.comcreate