Method: pylint.config._pylint_config.help_message.get_help
Calls: 5, Exceptions: 0, Paths: 1Back
Path 1: 5 calls (1.0)
ArgumentParser (5)
'usage: pylint-config [options]\n\nSubcommands:\n {generate}\n generate Generate a pylint configuration\n' (5)
1def get_help(parser: argparse.ArgumentParser) -> str:
2 """Get the help message for the main 'pylint-config' command.
3
4 Taken from argparse.ArgumentParser.format_help.
5 """
6 formatter = parser._get_formatter()
7
8 # usage
9 formatter.add_usage(
10 parser.usage, parser._actions, parser._mutually_exclusive_groups
11 )
12
13 # description
14 formatter.add_text(parser.description)
15
16 # positionals, optionals and user-defined groups
17 for action_group in parser._action_groups:
18 if action_group.title == "Subcommands":
19 formatter.start_section(action_group.title)
20 formatter.add_text(action_group.description)
21 formatter.add_arguments(action_group._group_actions)
22 formatter.end_section()
23
24 # epilog
25 formatter.add_text(parser.epilog)
26
27 # determine help from format above
28 return formatter.format_help()