/** 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 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 * @deprecated use {@link #detailedSynopsis(int, Comparator, boolean)} instead. */ @Deprecated public String detailedSynopsis(Comparator<OptionSpec> optionSort, boolean clusterBooleanOptions) { return detailedSynopsis(0, optionSort, clusterBooleanOptions); }
Help help = new Help(new Netstat(), ansi); help.synopsisHeading(""); sb.append(help.header()).append(help.detailedSynopsis(0, null, false)); sb.append(System.getProperty("line.separator"));
@SuppressWarnings("deprecation") @Test public void testDetailedSynopsis() { Help help = new Help(CommandSpec.create(), new Help.ColorScheme(Help.Ansi.OFF)); String str = help.detailedSynopsis(new Help.SortByShortestOptionNameAlphabetically(), true); assertEquals(String.format("<main class>%n"), str); }
Help help = new Help(new Netstat(), ansi); help.synopsisHeading(""); sb.append(help.header()).append(help.detailedSynopsis(0, null, false)); sb.append(System.getProperty("line.separator"));
assertEquals(String.format("cust%n"), help.customSynopsis()); assertEquals(String.format("base [COMMAND]%n"), help.abbreviatedSynopsis()); assertEquals(String.format("base [COMMAND]%n"), help.detailedSynopsis(0, null, true)); assertEquals("abcd", help.synopsisHeading()); assertEquals(String.format(" sub This is a subcommand%n"), help.commandList());
assertEquals(String.format("subcust%n"), help.customSynopsis()); assertEquals(String.format("sub%n"), help.abbreviatedSynopsis()); assertEquals(String.format("sub%n"), help.detailedSynopsis(0,null, true)); assertEquals("xyz", help.synopsisHeading()); assertEquals("", help.commandList());
assertEquals(String.format("cust%n"), help.customSynopsis()); assertEquals(String.format("base%n"), help.abbreviatedSynopsis()); assertEquals(String.format("base%n"), help.detailedSynopsis(0,null, true)); assertEquals("abcd", help.synopsisHeading()); assertEquals("", help.commandList());
/** * Returns a synopsis for the command, reserving the specified space for the synopsis heading. * @param synopsisHeadingLength the length of the synopsis heading that will be displayed on the same line * @return a synopsis * @see #abbreviatedSynopsis() * @see #detailedSynopsis(Comparator, boolean) * @see #synopsisHeading */ public String synopsis(int synopsisHeadingLength) { if (!empty(commandSpec.usageMessage().customSynopsis())) { return customSynopsis(); } return commandSpec.usageMessage().abbreviateSynopsis() ? abbreviatedSynopsis() : detailedSynopsis(synopsisHeadingLength, createShortOptionArityAndNameComparator(), true); }
@SuppressWarnings("deprecation") @Test public void testDetailedSynopsis() { Help help = new Help(CommandSpec.create(), new Help.ColorScheme(Help.Ansi.OFF)); String str = help.detailedSynopsis(new Help.SortByShortestOptionNameAlphabetically(), true); assertEquals(String.format("<main class>%n"), str); }
/** 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 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 * @deprecated use {@link #detailedSynopsis(int, Comparator, boolean)} instead. */ @Deprecated public String detailedSynopsis(Comparator<OptionSpec> optionSort, boolean clusterBooleanOptions) { return detailedSynopsis(0, optionSort, clusterBooleanOptions); }
assertEquals(String.format("cust%n"), help.customSynopsis()); assertEquals(String.format("base [COMMAND]%n"), help.abbreviatedSynopsis()); assertEquals(String.format("base [COMMAND]%n"), help.detailedSynopsis(0, null, true)); assertEquals("abcd", help.synopsisHeading()); assertEquals(String.format(" sub This is a subcommand%n"), help.commandList());
assertEquals(String.format("subcust%n"), help.customSynopsis()); assertEquals(String.format("sub%n"), help.abbreviatedSynopsis()); assertEquals(String.format("sub%n"), help.detailedSynopsis(0,null, true)); assertEquals("xyz", help.synopsisHeading()); assertEquals("", help.commandList());
assertEquals(String.format("cust%n"), help.customSynopsis()); assertEquals(String.format("base%n"), help.abbreviatedSynopsis()); assertEquals(String.format("base%n"), help.detailedSynopsis(0,null, true)); assertEquals("abcd", help.synopsisHeading()); assertEquals("", help.commandList());
/** * Returns a synopsis for the command, reserving the specified space for the synopsis heading. * @param synopsisHeadingLength the length of the synopsis heading that will be displayed on the same line * @return a synopsis * @see #abbreviatedSynopsis() * @see #detailedSynopsis(Comparator, boolean) * @see #synopsisHeading */ public String synopsis(int synopsisHeadingLength) { if (!empty(commandSpec.usageMessage().customSynopsis())) { return customSynopsis(); } return commandSpec.usageMessage().abbreviateSynopsis() ? abbreviatedSynopsis() : detailedSynopsis(synopsisHeadingLength, createShortOptionArityAndNameComparator(), true); }