if ((0 == toolArguments.length && tool.hasParams()) || 0 < toolArguments.length && "help".equals(toolArguments[0])) { if (tool instanceof TypedCmdLineTool) { System.out.println(((TypedCmdLineTool<?>) tool).getHelp(formatName)); } else if (tool instanceof BasicCmdLineTool) { System.out.println(tool.getHelp());
private static void usage() { System.out.print("OpenNLP " + Version.currentVersion().toString() + ". "); System.out.println("Usage: " + CMD + " TOOL"); System.out.println("where TOOL is one of:"); // distance of tool name from line start int numberOfSpaces = -1; for (String toolName : toolLookupMap.keySet()) { if (toolName.length() > numberOfSpaces) { numberOfSpaces = toolName.length(); } } numberOfSpaces = numberOfSpaces + 4; for (CmdLineTool tool : toolLookupMap.values()) { System.out.print(" " + tool.getName()); for (int i = 0; i < Math.abs(tool.getName().length() - numberOfSpaces); i++) { System.out.print(" "); } System.out.println(tool.getShortDescription()); } System.out.println("All tools print help when invoked with help parameter"); System.out.println("Example: opennlp SimpleTokenizer help"); }
protected String getBasicHelp(Class<?> argProxyInterface) { return getBasicHelp(new Class[]{argProxyInterface}); }
/** * Appends a tool * * @param groupName * @param toolName * @param tool * @param sb */ private static void appendTool(String groupName, String toolName, CmdLineTool tool, StringBuilder sb) { sb.append("<section id='tools.cli.").append(groupName).append(".") .append(toolName).append("'>\n\n"); sb.append("<title>").append(toolName).append("</title>\n\n"); sb.append("<para>").append(firstCaps(tool.getShortDescription())) .append("</para>\n\n"); appendCode(tool.getHelp(), sb); if (TypedCmdLineTool.class.isAssignableFrom(tool.getClass())) { appendHelpForTool((TypedCmdLineTool<?>) tool, sb); } sb.append("</section>\n\n"); }
protected <T> T validateAndParseParams(String[] args, Class<T> argProxyInterface) { String errorMessage = ArgumentParser.validateArgumentsLoudly(args, argProxyInterface); if (null != errorMessage) { throw new TerminateToolException(1, errorMessage + "\n" + getHelp()); } return ArgumentParser.parse(args, argProxyInterface); }
protected String getBasicHelp(Class<?>... argProxyInterfaces) { return "Usage: " + CLI.CMD + " " + getName() + " " + ArgumentParser.createUsage(argProxyInterfaces); }
/** * Appends a tool * * @param groupName * @param toolName * @param tool * @param sb */ private static void appendTool(String groupName, String toolName, CmdLineTool tool, StringBuilder sb) { sb.append("<section id='tools.cli.").append(groupName).append(".") .append(toolName).append("'>\n\n"); sb.append("<title>").append(toolName).append("</title>\n\n"); sb.append("<para>").append(firstCaps(tool.getShortDescription())) .append("</para>\n\n"); appendCode(tool.getHelp(), sb); if (TypedCmdLineTool.class.isAssignableFrom(tool.getClass())) { appendHelpForTool((TypedCmdLineTool<?>) tool, sb); } sb.append("</section>\n\n"); }
protected <T> T validateAndParseParams(String[] args, Class<T> argProxyInterface) { String errorMessage = ArgumentParser.validateArgumentsLoudly(args, argProxyInterface); if (null != errorMessage) { throw new TerminateToolException(1, errorMessage + "\n" + getHelp()); } return ArgumentParser.parse(args, argProxyInterface); }
protected String getBasicHelp(Class<?>... argProxyInterfaces) { return "Usage: " + CLI.CMD + " " + getName() + " " + ArgumentParser.createUsage(argProxyInterfaces); }
private static void usage() { System.out.print("OpenNLP Morfologik Addon " + Version.currentVersion().toString() + ". "); System.out.println("Usage: " + CMD + " TOOL"); System.out.println("where TOOL is one of:"); // distance of tool name from line start int numberOfSpaces = -1; for (String toolName : toolLookupMap.keySet()) { if (toolName.length() > numberOfSpaces) { numberOfSpaces = toolName.length(); } } numberOfSpaces = numberOfSpaces + 4; for (CmdLineTool tool : toolLookupMap.values()) { System.out.print(" " + tool.getName()); for (int i = 0; i < Math.abs(tool.getName().length() - numberOfSpaces); i++) { System.out.print(" "); } System.out.println(tool.getShortDescription()); } System.out.println("All tools print help when invoked with help parameter"); System.out.println("Example: opennlp-morfologik-addon POSDictionaryBuilder help"); }
if ((0 == toolArguments.length && tool.hasParams()) || 0 < toolArguments.length && "help".equals(toolArguments[0])) { if (tool instanceof TypedCmdLineTool) { System.out.println(((TypedCmdLineTool) tool).getHelp(formatName)); } else if (tool instanceof BasicCmdLineTool) { System.out.println(tool.getHelp());
/** * Appends a tool * * @param groupName * @param toolName * @param tool * @param sb */ private static void appendTool(String groupName, String toolName, CmdLineTool tool, StringBuilder sb) { sb.append("<section id='tools.cli.").append(groupName).append(".") .append(toolName).append("'>\n\n"); sb.append("<title>").append(toolName).append("</title>\n\n"); sb.append("<para>").append(firstCaps(tool.getShortDescription())) .append("</para>\n\n"); appendCode(tool.getHelp(), sb); if (TypedCmdLineTool.class.isAssignableFrom(tool.getClass())) { appendHelpForTool((TypedCmdLineTool<?>) tool, sb); } sb.append("</section>\n\n"); }
protected <T> T validateAndParseParams(String[] args, Class<T> argProxyInterface) { String errorMessage = ArgumentParser.validateArgumentsLoudly(args, argProxyInterface); if (null != errorMessage) { throw new TerminateToolException(1, errorMessage + "\n" + getHelp()); } return ArgumentParser.parse(args, argProxyInterface); }
protected String getBasicHelp(Class<?>... argProxyInterfaces) { return "Usage: " + CLI.CMD + " " + getName() + " " + ArgumentParser.createUsage(argProxyInterfaces); }
protected String getBasicHelp(Class<?> argProxyInterface) { return getBasicHelp(new Class[]{argProxyInterface}); }
private static void usage() { System.out.print("CoGrOO Grammar Checker. "); System.out.println("Usage: " + CMD + " TOOL"); System.out.println("where TOOL is one of:"); // distance of tool name from line start int numberOfSpaces = -1; for (String toolName : toolLookupMap.keySet()) { if (toolName.length() > numberOfSpaces) { numberOfSpaces = toolName.length(); } } numberOfSpaces = numberOfSpaces + 4; for (CmdLineTool tool : toolLookupMap.values()) { System.out.print(" " + tool.getName()); for (int i = 0; i < Math.abs(tool.getName().length() - numberOfSpaces); i++) { System.out.print(" "); } System.out.println(tool.getShortDescription()); } System.out.println("All tools print help when invoked with help parameter"); System.out.println("Example: cogroo GrammarChecker help"); }
if ((0 == toolArguments.length && tool.hasParams()) || 0 < toolArguments.length && "help".equals(toolArguments[0])) { if (tool instanceof TypedCmdLineTool) { System.out.println(((TypedCmdLineTool<?>) tool).getHelp(formatName)); } else if (tool instanceof BasicCmdLineTool) { System.out.println(tool.getHelp());
System.out.println(((TypedCmdLineTool) tool).getHelp(formatName)); } else if (tool instanceof BasicCmdLineTool) { System.out.println(tool.getHelp());
protected String getBasicHelp(Class<?> argProxyInterface) { return getBasicHelp(new Class[]{argProxyInterface}); }
private static void usage() { System.out.println("Usage: " + CMD + " TOOL"); System.out.println("where TOOL is one of:"); // distance of tool name from line start int numberOfSpaces = -1; for (String toolName : toolLookupMap.keySet()) { if (toolName.length() > numberOfSpaces) { numberOfSpaces = toolName.length(); } } numberOfSpaces = numberOfSpaces + 4; for (CmdLineTool tool : toolLookupMap.values()) { System.out.print(" " + tool.getName()); for (int i = 0; i < Math.abs(tool.getName().length() - numberOfSpaces); i++) { System.out.print(" "); } System.out.println(tool.getShortDescription()); } }