Module info.picocli
Package picocli

Class CommandLine.RegexTransformer

    • Method Detail

      • createDefault

        public static CommandLine.RegexTransformer createDefault()
        Returns the RegexTransformer used by default for negatable options.
        The regular expressions used by default for negatable options
        Regex Negative Replacement Synopsis Replacement Comment
        ^--no-(\w(-|\w)*)$ --$1 --[no-]$1 Converts --no-force to --force
        ^--(\w(-|\w)*)$ --no-$1 --[no-]$1 Converts --force to --no-force
        ^(-|--)(\w*:)\+(\w(-|\w)*)$ $1$2-$3 $1$2(+|-)$3 Converts -XX:+Inline to -XX:-Inline
        ^(-|--)(\w*:)\-(\w(-|\w)*)$ $1$2+$3 $1$2(+|-)$3 Converts -XX:-Inline to -XX:+Inline
      • createCaseInsensitive

        public static CommandLine.RegexTransformer createCaseInsensitive()
        Returns the RegexTransformer for case-insensitive negatable options.
        The regular expressions for case-insensitive negatable options
        Regex Negative Replacement Synopsis Replacement Comment
        ^--((?i)no)-(\w(-|\w)*)$ --$2 --[$1-]$2 Converts --no-force to --force and --NO-force to --force
        ^--(\w(-|\w)*)$ --no-$1 --[no-]$1 Converts --force to --no-force
        ^(-|--)(\w*:)\+(\w(-|\w)*)$ $1$2-$3 $1$2(+|-)$3 Converts -XX:+Inline to -XX:-Inline
        ^(-|--)(\w*:)\-(\w(-|\w)*)$ $1$2+$3 $1$2(+|-)$3 Converts -XX:-Inline to -XX:+Inline
      • makeNegative

        public String makeNegative​(String optionName,
                                   CommandLine.Model.CommandSpec cmd)
        Returns the negative form of the specified option name for the parser to recognize when parsing command line arguments.
        Specified by:
        makeNegative in interface CommandLine.INegatableOptionTransformer
        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 String makeSynopsis​(String optionName,
                                   CommandLine.Model.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
        Specified by:
        makeSynopsis in interface CommandLine.INegatableOptionTransformer
        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>