Package nz.org.riskscape.picocli
Class CommandLine.RegexTransformer.Builder
java.lang.Object
nz.org.riskscape.picocli.CommandLine.RegexTransformer.Builder
- Enclosing class:
- CommandLine.RegexTransformer
Builder for creating
RegexTransformer
objects.- Since:
- 4.0
-
Constructor Summary
ConstructorDescriptionBuilder()
Constructs an empty builder.Constructs a builder populated with the values from the specified RegexTransformer. -
Method Summary
Modifier and TypeMethodDescriptionaddPattern
(String regex, String negativeReplacement, String synopsisReplacement) Adds the specified negative replacement and synopsis replacement for the specified regular expression.build()
removePattern
(String regex) Removes the negative replacement and synopsis replacement for the specified regular expression.
-
Constructor Details
-
Builder
public Builder()Constructs an empty builder. -
Builder
Constructs a builder populated with the values from the specified RegexTransformer.
-
-
Method Details
-
addPattern
public CommandLine.RegexTransformer.Builder addPattern(String regex, String negativeReplacement, String synopsisReplacement) Adds the specified negative replacement and synopsis replacement for the specified regular expression. For example, to add negative forms for short options:
Regular expressions for adding negative forms for short options Regex Negative Replacement Synopsis Replacement Comment ^-(\w)$ +$1 (+|-)$1 Converts -v
to+v
^+(\w)$ -$1 (+|-)$1 Converts -v
to+v
- Parameters:
regex
- regular expression to match an option namenegativeReplacement
- the replacement to use to generate a negative name when the option name matchessynopsisReplacement
- the replacement to use to generate a documentation string when the option name matches- Returns:
- this
RegexTransformer
for method chaining
-
removePattern
Removes the negative replacement and synopsis replacement for the specified regular expression.
- Parameters:
regex
- regular expression to remove- Returns:
- this
RegexTransformer
for method chaining
-
build
-