ee389beb8c
- Add 72 rebrand workflow files (polkadot→pezkuwi, substrate→bizinikiwi, cumulus→pezcumulus) - Add GitHub actions, issue templates, and configs - Removed unnecessary workflows (fork-sync, gitspiegel, upstream-tracker, sync-templates, backport) - Renamed zombienet test files to match new naming convention
27 lines
854 B
Python
27 lines
854 B
Python
import argparse
|
|
|
|
"""
|
|
|
|
Custom help action for argparse, it prints the help message for the main parser and all subparsers.
|
|
|
|
"""
|
|
|
|
|
|
class _HelpAction(argparse._HelpAction):
|
|
def __call__(self, parser, namespace, values, option_string=None):
|
|
parser.print_help()
|
|
|
|
# retrieve subparsers from parser
|
|
subparsers_actions = [
|
|
action for action in parser._actions
|
|
if isinstance(action, argparse._SubParsersAction)]
|
|
# there will probably only be one subparser_action,
|
|
# but better save than sorry
|
|
for subparsers_action in subparsers_actions:
|
|
# get all subparsers and print help
|
|
for choice, subparser in subparsers_action.choices.items():
|
|
print("\n### Command '{}'".format(choice))
|
|
print(subparser.format_help())
|
|
|
|
parser.exit()
|