vertx / io.vertx.core.cli / UsageMessageFormatter

UsageMessageFormatter

open class UsageMessageFormatter

Usage message formatter.

Author
Clement Escoffier

Constructors

<init>

UsageMessageFormatter()

Usage message formatter.

Properties

DEFAULT_ARG_NAME

static val DEFAULT_ARG_NAME: String

default name for an argument

DEFAULT_DESC_PAD

static val DEFAULT_DESC_PAD: Int

number of space characters to be prefixed to each description line

DEFAULT_LEFT_PAD

static val DEFAULT_LEFT_PAD: Int

default padding to the left of each line

DEFAULT_LONG_OPT_PREFIX

static val DEFAULT_LONG_OPT_PREFIX: String

default prefix for long Option

DEFAULT_LONG_OPT_SEPARATOR

static val DEFAULT_LONG_OPT_SEPARATOR: String

default separator displayed between a long Option and its value

DEFAULT_OPT_PREFIX

static val DEFAULT_OPT_PREFIX: String

default prefix for shortOpts

DEFAULT_USAGE_PREFIX

static val DEFAULT_USAGE_PREFIX: String

the string to display at the beginning of the usage statement

DEFAULT_WIDTH

static val DEFAULT_WIDTH: Int

default number of characters per line

Functions

buildWrapped

open fun buildWrapped(buffer: StringBuilder, text: String): Unit
open fun buildWrapped(buffer: StringBuilder, nextLineTabStop: Int, text: String): Unit

Builds the specified text to the specified buffer.

computeOptionsAndArguments

open fun computeOptionsAndArguments(buffer: StringBuilder, options: MutableList<Option>, arguments: MutableList<Argument>): Unit

Computes the help for the specified Options to the specified writer.

computeUsage

open fun computeUsage(buffer: StringBuilder, cmdLineSyntax: String): Unit

computeUsageLine

open fun computeUsageLine(buffer: StringBuilder, prefix: String, cli: CLI): Unit

createPadding

open static fun createPadding(len: Int): String

Return a String of padding of length len.

findWrapPos

open static fun findWrapPos(text: String, width: Int, startPos: Int): Int

Finds the next text wrap position after startPos for the text in text with the column width width. The wrap point is the last position before startPos+width having a whitespace character (space, \n, \r). If there is no whitespace character before startPos+width, it will return startPos+width.

getArgName

open fun getArgName(): String

getDescPadding

open fun getDescPadding(): Int

getLeftPadding

open fun getLeftPadding(): Int

getLongOptionPrefix

open fun getLongOptionPrefix(): String

getLongOptionSeparator

open fun getLongOptionSeparator(): String

Returns the separator displayed between a long option and its value.

getNewLine

open fun getNewLine(): String

getOptionComparator

open fun getOptionComparator(): Comparator<Option>

Comparator used to sort the options when they output in help text. Defaults to case-insensitive alphabetical sorting by option key.

getOptionPrefix

open fun getOptionPrefix(): String

getUsagePrefix

open fun getUsagePrefix(): String

getWidth

open fun getWidth(): Int

isNullOrEmpty

open static fun isNullOrEmpty(s: String): Boolean

renderWrappedTextBlock

open fun renderWrappedTextBlock(sb: StringBuilder, width: Int, nextLineTabStop: Int, text: String): Appendable

Renders the specified text width a maximum width. This method differs from renderWrappedText by not removing leading spaces after a new line.

rtrim

open static fun rtrim(s: String): String

Remove the trailing whitespace from the specified String.

setArgName

open fun setArgName(name: String): Unit

setDescPadding

open fun setDescPadding(padding: Int): Unit

setLeftPadding

open fun setLeftPadding(padding: Int): Unit

setLongOptionPrefix

open fun setLongOptionPrefix(prefix: String): Unit

setLongOptionSeparator

open fun setLongOptionSeparator(longOptSeparator: String): Unit

Set the separator displayed between a long option and its value. Ensure that the separator specified is supported by the parser used, typically ' ' or '='.

setNewLine

open fun setNewLine(newline: String): Unit

setOptionComparator

open fun setOptionComparator(comparator: Comparator<Option>): Unit

Set the comparator used to sort the options when they output in help text. Passing in a null comparator will keep the options in the order they were declared.

setOptionPrefix

open fun setOptionPrefix(prefix: String): Unit

setUsagePrefix

open fun setUsagePrefix(prefix: String): Unit

setWidth

open fun setWidth(width: Int): Unit

usage

open fun usage(builder: StringBuilder, cli: CLI): Unit
open fun usage(builder: StringBuilder, prefix: String, cli: CLI): Unit

Computes the usage of the given CLI.