public void printDescriptionSection(CommandDescriptor<?> command, Appendable stream) throws IOException { String man = command.getDescription().getMan(); if (man.length() > 0) { stream.append("DESCRIPTION\n"); Util.indent(Util.MAN_TAB, man, stream); stream.append("\n\n"); } }
protected void printSubordinates(CommandDescriptor<?> command, Appendable stream) throws IOException { for (CommandDescriptor<?> subordinate : command.getSubordinates().values()) { stream.append(Util.MAN_TAB).append(subordinate.getName()); String methodText = subordinate.getDescription().getBestEffortMan(); if (methodText.length() > 0) { stream.append("\n"); Util.indent(Util.MAN_TAB_EXTRA, methodText, stream); } stream.append("\n\n"); } }
private HelpDescriptor(HelpDescriptor<T> owner, CommandDescriptor<T> delegate) throws IntrospectionException { super(delegate.getName(), delegate.getDescription());
public void testClassDescription() throws Exception { @Usage("class_usage") @Man("class_man") class A { } CommandDescriptor<Instance<A>> c = CommandFactory.DEFAULT.create(A.class); assertEquals("class_usage", c.getUsage()); assertEquals("class_usage", c.getDescription().getUsage()); assertEquals("class_man", c.getDescription().getMan()); }
public void testMethodDescription() throws Exception { class A { @Usage("method_usage") @Man("method_man") @Command void m() {} } CommandDescriptor<Instance<A>> c = CommandFactory.DEFAULT.create(A.class); CommandDescriptor<Instance<A>> m = c.getSubordinate("m"); assertEquals("method_usage", m.getUsage()); assertEquals("method_usage", m.getDescription().getUsage()); assertEquals("method_man", m.getDescription().getMan()); }
public void testNoDescription() throws Exception { class A { } CommandDescriptor<Instance<A>> c = CommandFactory.DEFAULT.create(A.class); assertEquals("", c.getUsage()); assertEquals(new Description(), c.getDescription()); }
public void printDescriptionSection(CommandDescriptor<?> command, Appendable stream) throws IOException { String man = command.getDescription().getMan(); if (man.length() > 0) { stream.append("DESCRIPTION\n"); Util.indent(Util.MAN_TAB, man, stream); stream.append("\n\n"); } }
protected void printSubordinates(CommandDescriptor<?> command, Appendable stream) throws IOException { for (CommandDescriptor<?> subordinate : command.getSubordinates().values()) { stream.append(Util.MAN_TAB).append(subordinate.getName()); String methodText = subordinate.getDescription().getBestEffortMan(); if (methodText.length() > 0) { stream.append("\n"); Util.indent(Util.MAN_TAB_EXTRA, methodText, stream); } stream.append("\n\n"); } }
private HelpDescriptor(HelpDescriptor<T> owner, CommandDescriptor<T> delegate) throws IntrospectionException { super(delegate.getName(), delegate.getDescription());
String man = getDescription().getMan(); if (man.length() > 0) { writer.append("DESCRIPTION\n"); for (CommandDescriptor<T> method : methods.values()) { writer.append(Util.MAN_TAB).append(method.getName()); String methodText = method.getDescription().getBestEffortMan(); if (methodText.length() > 0) { writer.append("\n"); String man = getDescription().getMan(); if (man.length() > 0) { writer.append("DESCRIPTION\n");