Multiple level argparse subparsers

喜夏-厌秋 提交于 2019-12-24 16:02:48

问题


I have multiple levels of subparsers within subparsers, but when I run the program with help flag, I see help messages and choices only for top level options. How can I see help for all suboptions, or for specific suboption in deeper level?


回答1:


To get the help for a subparser, use a command like python prog.py cmd1 -h. To get the help for a sub-subparser, python prog.py cmd1 cmd12 -h should work.

There isn't a means, with the default help mechanism, to show the help for the main parser and all the subparsers (and sub-subparsers) with one command. It just gets too complicated.

I'd suggest custom usage and description. That includes titles and descriptions for the subparsers, etc.



来源:https://stackoverflow.com/questions/30088739/multiple-level-argparse-subparsers

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!