/** Generates a detailed synopsis message showing all options and parameters. Follows the unix convention of * showing optional options and parameters in square brackets ({@code [ ]}). * @param synopsisHeadingLength the length of the synopsis heading that will be displayed on the same line * @param optionSort comparator to sort options or {@code null} if options should not be sorted * @param clusterBooleanOptions {@code true} if boolean short options should be clustered into a single string * @return a detailed synopsis * @since 3.0 */ public String detailedSynopsis(int synopsisHeadingLength, Comparator<OptionSpec> optionSort, boolean clusterBooleanOptions) { Text optionText = createDetailedSynopsisOptionsText(optionSort, clusterBooleanOptions); Text positionalParamText = createDetailedSynopsisPositionalsText(); Text commandText = createDetailedSynopsisCommandText(); Text text = optionText.concat(positionalParamText).concat(commandText); return insertSynopsisCommandName(synopsisHeadingLength, text); }
@Test public void testHelpCreateDetailedSynopsisOptionsText() { Help help = new Help(CommandSpec.create().addOption(OptionSpec.builder("xx").build()), new ColorScheme(Help.Ansi.OFF)); Text text = help.createDetailedSynopsisOptionsText(null, true); assertEquals(" [xx]", text.toString()); }
/** Generates a detailed synopsis message showing all options and parameters. Follows the unix convention of * showing optional options and parameters in square brackets ({@code [ ]}). * @param synopsisHeadingLength the length of the synopsis heading that will be displayed on the same line * @param optionSort comparator to sort options or {@code null} if options should not be sorted * @param clusterBooleanOptions {@code true} if boolean short options should be clustered into a single string * @return a detailed synopsis * @since 3.0 */ public String detailedSynopsis(int synopsisHeadingLength, Comparator<OptionSpec> optionSort, boolean clusterBooleanOptions) { Text optionText = createDetailedSynopsisOptionsText(optionSort, clusterBooleanOptions); Text positionalParamText = createDetailedSynopsisPositionalsText(); Text commandText = createDetailedSynopsisCommandText(); Text text = optionText.concat(positionalParamText).concat(commandText); return insertSynopsisCommandName(synopsisHeadingLength, text); }
@Test public void testHelpCreateDetailedSynopsisOptionsText() { Help help = new Help(CommandSpec.create().addOption(OptionSpec.builder("xx").build()), new ColorScheme(Help.Ansi.OFF)); Text text = help.createDetailedSynopsisOptionsText(null, true); assertEquals(" [xx]", text.toString()); }