Returns the help output in plain text format.
164421
def get_help_text(self):
        

        txt = str('\n')
        for name, info in self.commands.items():
            command_txt = "\t{0: <22} {1}\n".format(name, info['description'])
            if info['attributes']:
                command_txt = ''.join([command_txt, "\t Attributes:\n"])
                for attrname, attrdesc in info['attributes'].items():
                    attr_txt = "\t  {0: <22} {1}\n".format(attrname, attrdesc)
                    command_txt = ''.join([command_txt, attr_txt])
            if info['elements']:
                command_txt = ''.join([command_txt, "\t Elements:\n",
                                       self.elements_as_text(info['elements'])])
            txt = ''.join([txt, command_txt])
        return txt
299127
def default_help_formatter(quick_helps):
    
    ret = ''
    for line in quick_helps:
        cmd_path, param_hlp, cmd_hlp = line
        ret += ' '.join(cmd_path) + ' '
        if param_hlp:
            ret += param_hlp + ' '
        ret += '- ' + cmd_hlp + '\n'
    return ret
474384
def generate_help(self):
        
        result = []
        result.append(self.__class__.__name__)
        result.append(re.sub(r'.', '=', self.__class__.__name__))
        result.append("")
        result.append("Supported value names:")
        for a in self.allowed:
            result.append(a)
        return '\n'.join(result)
1145906
def parse_help_text(self, file_path):
        '''  '''
        with open(file_path) as f:
            lines = f.readlines()

        # Parse commands and descriptions, which are separated by a multi-space
        # (any sequence of two or more space characters in a row.
        cmds = []
        descs = []
        for line in lines:
            line = line.strip()
            if len(line) == 0:
                cmds.append('')
                descs.append('')
            else:
                tokens = line.split('  ')
                cmds.append(tokens[0])
                descs.append(''.join(tokens[1:]).strip())

        max_len = len(max(cmds, key=len))

        # Convert commands and descriptions into help text.
        text = ''
        for cmd, desc in zip(cmds, descs):
            if len(cmd) == 0:
                text += '\n'
            else:
                text += self.style.help(cmd.ljust(max_len + 2), desc + '\n')

        return cmds, text
868789
private String helpText(Option option) {
		StringBuilder sb = new StringBuilder(HELP_TEXT_LENGTH_PER_PARAM);
		sb.append(HELP_TEXT_PARAM_DELIMITER);

		// if there is a short name, add it.
		if (option.hasAlt()) {
			sb.append("-");
			sb.append(option.getAlt());
			sb.append(", ");
		}

		// add the name
		sb.append("--");
		sb.append(option.getName());
		sb.append(HELP_TEXT_PARAM_DELIMITER);

		// if there is a help text, add it
		if (option.getHelpText() != null) {
			sb.append(option.getHelpText());
			sb.append(HELP_TEXT_PARAM_DELIMITER);
		}

		// if there is a default value, add it.
		if (option.hasDefaultValue()) {
			sb.append("default: ");
			sb.append(option.getDefaultValue());
			sb.append(HELP_TEXT_PARAM_DELIMITER);
		}

		// if there is a list of choices add it.
		if (!option.getChoices().isEmpty()) {
			sb.append("choices: ");
			for (String choice : option.getChoices()) {
				sb.append(choice);
				sb.append(" ");
			}
		}
		sb.append(HELP_TEXT_LINE_DELIMITER);

		return sb.toString();
	}
1207775
def help(help_options={})
      comment_starting_with = help_options[:comment_starting_with] || ""
      located_in_file = help_options[:located_in_file] || __FILE__
      text = File.read(located_in_file)

      result = text.match(/(^\s*#\s*#{comment_starting_with}.*)^\s*class .* AppAction/m)
      result = $1
      result = result.gsub(/ @example/, '')
      result = result.gsub(/ @return \[Number\]/, ' Exit code:')
      result = result.gsub(/ @return .*/, '')
      result = result.gsub(/ @see .*$/, '')

      # strip the leading whitespace, the '#' and space
      result = result.gsub(/^\s*# ?/, '')

      # strip surrounding whitespace
      result.strip
    end
553243
def format_help(help):
    """"""
    help = help.replace("Options:", str(crayons.normal("Options:", bold=True)))
    help = help.replace(
        "Usage: pipenv", str("Usage: {0}".format(crayons.normal("pipenv", bold=True)))
    )
    help = help.replace("  check", str(crayons.red("  check", bold=True)))
    help = help.replace("  clean", str(crayons.red("  clean", bold=True)))
    help = help.replace("  graph", str(crayons.red("  graph", bold=True)))
    help = help.replace("  install", str(crayons.magenta("  install", bold=True)))
    help = help.replace("  lock", str(crayons.green("  lock", bold=True)))
    help = help.replace("  open", str(crayons.red("  open", bold=True)))
    help = help.replace("  run", str(crayons.yellow("  run", bold=True)))
    help = help.replace("  shell", str(crayons.yellow("  shell", bold=True)))
    help = help.replace("  sync", str(crayons.green("  sync", bold=True)))
    help = help.replace("  uninstall", str(crayons.magenta("  uninstall", bold=True)))
    help = help.replace("  update", str(crayons.green("  update", bold=True)))
    additional_help = """
Usage Examples:
   Create a new project using Python 3.7, specifically:
   $ {1}

   Remove project virtualenv (inferred from current directory):
   $ {9}

   Install all dependencies for a project (including dev):
   $ {2}

   Create a lockfile containing pre-releases:
   $ {6}

   Show a graph of your installed dependencies:
   $ {4}

   Check your installed dependencies for security vulnerabilities:
   $ {7}

   Install a local setup.py into your virtual environment/Pipfile:
   $ {5}

   Use a lower-level pip command:
   $ {8}

Commands:""".format(
        crayons.red("pipenv --three"),
        crayons.red("pipenv --python 3.7"),
        crayons.red("pipenv install --dev"),
        crayons.red("pipenv lock"),
        crayons.red("pipenv graph"),
        crayons.red("pipenv install -e ."),
        crayons.red("pipenv lock --pre"),
        crayons.red("pipenv check"),
        crayons.red("pipenv run pip freeze"),
        crayons.red("pipenv --rm"),
    )
    help = help.replace("Commands:", additional_help)
    return help
1073619
def _format_help_dicts(help_dicts, display_defaults=False):
    
    help_strs = []
    for help_dict in help_dicts:
        help_str = "%s (%s" % (
            help_dict["var_name"],
            "Required" if help_dict["required"] else "Optional",
        )
        if help_dict.get("default") and display_defaults:
            help_str += ", Default=%s)" % help_dict["default"]
        else:
            help_str += ")"
        if help_dict.get("help_str"):
            help_str += ": %s" % help_dict["help_str"]
        help_strs.append(help_str)

    return "\n".join(help_strs)
725755
def get_fmt_section(self):
        """"""
        if self.b_format_txt:
            return self.fmtname2wbfmtobj.get("light grey")
        return self.fmtname2wbfmtobj.get("plain bold")
1197866
def doc_to_help(doc):
  """"""

  # Get rid of starting and ending white space. Using lstrip() or even
  # strip() could drop more than maximum of first line and right space
  # of last line.
  doc = doc.strip()

  # Get rid of all empty lines.
  whitespace_only_line = re.compile('^[ \t]+$', re.M)
  doc = whitespace_only_line.sub('', doc)

  # Cut out common space at line beginnings.
  doc = trim_docstring(doc)

  # Just like this module's comment, comments tend to be aligned somehow.
  # In other words they all start with the same amount of white space.
  # 1) keep double new lines;
  # 2) keep ws after new lines if not empty line;
  # 3) all other new lines shall be changed to a space;
  # Solution: Match new lines between non white space and replace with space.
  doc = re.sub(r'(?<=\S)\n(?=\S)', ' ', doc, flags=re.M)

  return doc
150777
def help_heading(self):
        
        message = m.Heading(
            tr('Help for {step_name}').format(step_name=self.step_name),
            **SUBSECTION_STYLE)
        return message
810029
def complete_help_command(self, text: str, line: str, begidx: int, endidx: int) -> List[str]:
        """"""

        # Complete token against topics and visible commands
        topics = set(self.get_help_topics())
        visible_commands = set(self.get_visible_commands())
        strs_to_match = list(topics | visible_commands)
        return self.basic_complete(text, line, begidx, endidx, strs_to_match)
1170907
def format_help(self, tokens: List[str]) -> str:
        """"""
        for idx, token in enumerate(tokens):
            if idx >= self._token_start_index:
                if self._positional_completers:
                    # For now argparse only allows 1 sub-command group per level
                    # so this will only loop once.
                    for completers in self._positional_completers.values():
                        if token in completers:
                            return completers[token].format_help(tokens)
        return self._parser.format_help()
1170536
def _output_text(complete_output, categories):
    
    output = ""

    for result in complete_output:
        list_result = complete_output[result]
        if list_result:
            list_result_sorted = sorted(list_result,
                                        key=lambda x: list_result[x],
                                        reverse=True)
            output += "\n\n{0}:\n".format(result)
            for element in list_result_sorted:
                output += "\n{0} {1}".format(list_result[element], element)

    output += "\n--"

    return output
210811
def help(self, args=None, userlevel=9):
        """"""
        out = [main.__file__+"\n"]

        if args is not None:
            parsed = self.parse(args, ignore_help=True)
        else:
            parsed = self._default_dict()

        for thing in self.options:
            if type(thing) == str:
                out.append("     "+thing)
            elif thing[0] <= userlevel:
                out.append("     %10s   %s ( %s )" % (thing[1], thing[-1], str(parsed[thing[2]])))

        return "\n".join(out)+"\n"
1061676
def print_help(self, short=False):
        
        header = [
            u"",
            u"NAME",
            u"  %s - %s" % (self.NAME, self.HELP["description"]),
            u"",
        ]

        synopsis = [
            u"SYNOPSIS",
            u"  %s [-h|--help|--help-rconf|--version]" % (self.invoke),
        ]
        if "synopsis" in self.HELP:
            for syn, opt in self.HELP["synopsis"]:
                if opt:
                    opt = u" [OPTIONS]"
                else:
                    opt = u""
                synopsis.append(u"  %s %s%s" % (self.invoke, syn, opt))

        synopsis.append(u"")

        options = [
            u"  -h : print short help and exit",
            u"  --help : print full help and exit",
            u"  --help-rconf : list all runtime configuration parameters",
            u"  --version : print the program name and version and exit",
            u"  -l[=FILE], --log[=FILE] : log verbose output to tmp file or FILE if specified",
            u"  -r=CONF, --runtime-configuration=CONF : apply runtime configuration CONF",
            u"  -v, --verbose : verbose output",
            u"  -vv, --very-verbose : verbose output, print date/time values",
        ]
        if "options" in self.HELP:
            for opt in self.HELP["options"]:
                options.append(u"  %s" % (opt))
        options = [u"OPTIONS"] + sorted(options) + [u""]

        parameters = []
        if ("parameters" in self.HELP) and (len(self.HELP["parameters"]) > 0):
            parameters.append(u"PARAMETERS")
            for par in self.HELP["parameters"]:
                parameters.append(u"  %s" % (par))
            parameters.append(u"")

        examples = []
        if ("examples" in self.HELP) and (len(self.HELP["examples"]) > 0):
            examples.append(u"EXAMPLES")
            for exa in self.HELP["examples"]:
                examples.append(u"  %s %s" % (self.invoke, exa))
            examples.append(u"")

        footer = [
            u"EXIT CODES",
            u"  %d : no error" % (self.NO_ERROR_EXIT_CODE),
            u"  %d : error" % (self.ERROR_EXIT_CODE),
            u"  %d : help shown, no command run" % (self.HELP_EXIT_CODE),
            u"",
            u"AUTHOR",
            u"  Alberto Pettarin, http://www.albertopettarin.it/",
            u"",
            u"REPORTING BUGS",
            u"  Please use the GitHub Issues Web page : %s" % (self.ISSUES_URL),
            u"",
            u"COPYRIGHT",
            u"  2012-2017, Alberto Pettarin and ReadBeyond Srl",
            u"  This software is available under the terms of the GNU Affero General Public License Version 3",
            u"",
            u"SEE ALSO",
            u"  Code repository  : %s" % (self.GITHUB_URL),
            u"  Documentation    : %s" % (self.DOCS_URL),
            u"  Project Web page : %s" % (self.AENEAS_URL),
            u"",
        ]

        msg = header + synopsis + options + parameters + examples
        if not short:
            msg += footer
        if self.use_sys:
            self.print_generic(u"\n".join(msg))
        return self.exit(self.HELP_EXIT_CODE)
216189
def help_function(self, command=None):
        
        if command:
            return self.registered[command].get(
                'description', 'No help available'
            )
        return ', '.join(sorted(self.registered))