MCPcopy Create free account
hub / github.com/gitless-vcs/gitless / print_help

Function print_help

gitless/cli/gl.py:53–68  ·  view source on GitHub ↗

print help for humans

(parser)

Source from the content-addressed store, hash-verified

51
52
53def print_help(parser):
54 """print help for humans"""
55 print(parser.description)
56 print('\ncommands:\n')
57
58 # https://stackoverflow.com/questions/20094215/argparse-subparser-monolithic-help-output
59 # retrieve subparsers from parser
60 subparsers_actions = [
61 action for action in parser._actions
62 if isinstance(action, argparse._SubParsersAction)]
63 # there will probably only be one subparser_action,
64 # but better safe than sorry
65 for subparsers_action in subparsers_actions:
66 # get all subparsers and print help
67 for choice in subparsers_action._choices_actions:
68 print(' {:<19} {}'.format(choice.dest, choice.help))
69
70def main():
71 parser = argparse.ArgumentParser(

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected