Skip to content

Package io.github.qishr.cascara.common.util

Interface INegatableOptionTransformer

java.lang.Object
        io.github.qishr.cascara.common.util.CommandLine.INegatableOptionTransformer

Enclosing Class:
    io.github.qishr.cascara.common.util.CommandLine

All Known Implementing Classes:
    RegexTransformer


public static interface INegatableOptionTransformer

Determines the option name transformation of negatable boolean options.Making an option negatable has two aspects:

the negative form recognized by the parser while parsing the command line the documentation string showing both the positive and the negative form in the usage help message

Additionally, this transformer controls which names of a negatable option are actually negatable: for example, by default short options like -v do not have a negative form, even if the same option's long form, --verbose, may have a negative form, --no-verbose.

Method Summary

Modifier and Type Method Description
public abstract String makeNegative(String optionName, CommandSpec cmd) Returns the negative form of the specified option name for the parser to recognize when parsing command line arguments.
public abstract String makeSynopsis(String optionName, CommandSpec cmd) Returns the documentation string to show in the synopsis and usage help message for the specified option.

Method Details

makeNegative

public abstract String makeNegative(String optionName, CommandSpec cmd)

Returns the negative form of the specified option name for the parser to recognize when parsing command line arguments.

Parameters:

optionName - the option name to create a negative form for, for example --force

cmd - the command that the option is part of

Returns:

the negative form of the specified option name, for example --no-force


makeSynopsis

public abstract String makeSynopsis(String optionName, CommandSpec cmd)

Returns the documentation string to show in the synopsis and usage help message for the specified option.The returned value should be concise and clearly suggest that both the positive and the negative form are valid option names

Parameters:

optionName - the option name to create a documentation string for, for example --force, or -XX:+<option>

cmd - the command that the option is part of

Returns:

the documentation string for the negatable option, for example --[no-]force, or -XX:(+|-)<option>