def help(self, value, via):
        width = self.width()

        # Output the summary information.
        for i, spec in enumerate(self.stack):
            summary, description = spec.doc or (None, None)

            if not i:
                if summary: print(wrap(summary, width))
                print("Usage:", os.path.basename(sys.argv[0]), end=" ")

            else:
                print(spec.callable.__name__, end=" ")

            if spec.named:
                print("[CMDOPTS]" if i else "[OPTIONS]", end=" ")

            if spec.keyed:
                print("[--name=value...]", end=" ")

            for arg in spec.positional:
                print("<", arg, ">", sep="", end=" ")

            if spec.indexed:
                print("[value...]", end=" ")

            if spec.cls and len(self.stack) == i + 1:
                print("<COMMAND> ...", end="")

        print()

        # Output the details.
        for i, spec in enumerate(self.stack):
            summary, description = spec.doc or (None, None)

            if i:
                print("\nCommand:", spec.callable.__name__)
                if summary: print(wrap(summary, width))

            if spec.named:
                print("\n", "CMDOPTS" if i else "OPTIONS", " may be one or more of:", sep="", end="\n\n")

                strings = dict()
                abbreviation = dict(zip(spec.short.values(), spec.short.keys()))
                pretty = dict(zip(spec.trans.values(), spec.trans.keys()))

                for name in spec.named:
                    default = spec.defaults.get(name)

                    if spec.cast.get(name, None) is boolean:
                        strings[(("-" + abbreviation[name] + ", ") if name in abbreviation else "") + "--" + pretty.get(name, name)] = \
                                spec.docs.get(name, "Toggle this value.\nDefault: %r" % default)
                        continue

                    strings["-" + abbreviation[name] + ", --" + pretty.get(name, name) + "=VAL"] = \
                            spec.docs.get(name, "Override this value.\nDefault: %r" % default)

                mlen = max([len(j) for j in strings])
                for name in sorted(strings):
                    print(" %-*s  %s" % (mlen, name, wrap(strings[name], width).replace("\n", "\n" + " " * (mlen + 3))))

            if spec.cls and len(self.stack) == i + 1:
                print("\n", "COMMAND may be one of:", sep="", end="\n\n")

                cmds = dict()
                for cmd in dir(spec.target):
                    if cmd[0] == '_' or not callable(getattr(spec.target, cmd)): continue
                    cmds[cmd] = partitionhelp(getdoc(getattr(spec.target, cmd)) or "Undocumented command.")[0]

                mlen = max([len(i) for i in cmds])
                for name in sorted(cmds):
                    print(" %-*s  %s" % (mlen, name, wrap(cmds[name], width).replace("\n", "\n" + " " * (mlen + 3))))

                print("\n", wrap("For help on a specific command, call the command and pass --help in CMDOPTS.", width), sep="")

            if description: print("\n", wrap(description, width), sep="")

        print()

        raise ExitException(os.EX_USAGE, None)
Display a GNU-ish help page listing arguments and possible sub-commands.
dataset/ETHPy150Open marrow/script/marrow/script/core.py/Parser.help