def _help_text()

in ebcli/core/base.py [0:0]


    def _help_text(self):
        """
        Prints the output of `eb --help`
        """
        longest = 0

        def pad(label):
            padlength = longest - len(label) + 2
            padding = '   '
            if padlength < 0:
                for x in range(0, longest):
                    padding += ' '
            else:
                for x in range(0, padlength):
                    padding += ' '
            return padding

        help_txt = ''
        for label in self._visible_commands:
            # get longest command
            if len(label) > longest:
                longest = len(label)

        command_help_overrides = {
            'platform': 'Commands for managing platforms.'
        }
        for label in self._visible_commands:
            cmd = self._dispatch_map[label]
            cmd_txt = '  '
            if len(cmd['aliases']) > 0 and cmd['aliases_only']:
                if len(cmd['aliases']) > 1:
                    first = cmd['aliases'].pop(0)
                    cmd_txt += "%s (alias: %s)\n" % \
                               (first, ', '.join(cmd['aliases']))
                else:
                    cmd_txt += "%s" % cmd['alias'][0]
            elif len(cmd['aliases']) > 0:
                cmd_txt += "%s (alias: %s)\n" % (label, ', '.join(cmd['aliases']))
            else:
                cmd_txt += label

            if cmd['help']:
                cmd_txt += pad(cmd_txt) + "%s\n" % (command_help_overrides.get(label) or cmd['help'])
            else:
                cmd_txt += "\n"

            help_txt += cmd_txt

        if len(help_txt) > 0:
            txt = '''%s