protected String getDescription(CmdLineAction action) { StringBuilder sb = new StringBuilder("> DESCRIPTION:\n"); if (action.getDetailedDescription() != null) { sb.append(" ").append(action.getDetailedDescription() .replaceAll("^\\s*", "").replaceAll("\\s*$", "")); } else if (action.getDescription() != null) { sb.append(" ").append( action.getDescription().replaceAll("^\\s*", "") .replaceAll("\\s*$", "")); } else { sb.append(" - N/A"); } return sb.append("\n").toString(); }
protected String getExamples(CmdLineAction action) { StringBuilder sb = new StringBuilder("> EXAMPLES:\n"); if (action.getExamples() != null) { sb.append(" ").append(action.getExamples().replaceAll("^\\s*", "") .replaceAll("\\s*$", "")); } else { sb.append(" - N/A"); } return sb.toString(); }
protected String getHeader(CmdLineAction action) { return "** Action Help for '" + action.getName() + "' **"; }
@Override public String printActionsHelp(Set<CmdLineAction> actions) { StringBuilder sb = new StringBuilder(""); sb.append("-----------------------------------------------------------------------------------------------------------------\n"); sb.append("|").append(StringUtils.rightPad(" Action", 35)).append("|").append(" Description\n"); sb.append("-----------------------------------------------------------------------------------------------------------------\n"); for (CmdLineAction action : sortActions(actions)) { sb.append(" ").append(StringUtils.rightPad(action.getName(), 35)); sb.append(" ").append(action.getDescription()).append("\n\n"); } sb.append("-----------------------------------------------------------------------------------------------------------------\n"); return sb.toString(); }
private void handleSettingNameForCmdLineActions() { @SuppressWarnings("unchecked") Map<String, CmdLineAction> beans = appContext .getBeansOfType(CmdLineAction.class); for (Entry<String, CmdLineAction> entry : beans.entrySet()) { entry.getValue().setName(entry.getKey()); } } }
cmdLineArgs.getSpecifiedAction().execute(printer); printActionMessages(printer.getPrintedMessages());
@Override public String printActionsHelp(Set<CmdLineAction> actions) { StringBuilder sb = new StringBuilder(""); sb.append("-----------------------------------------------------------------------------------------------------------------\n"); sb.append("|").append(StringUtils.rightPad(" Action", 35)).append("|").append(" Description\n"); sb.append("-----------------------------------------------------------------------------------------------------------------\n"); for (CmdLineAction action : sortActions(actions)) { sb.append(" ").append(StringUtils.rightPad(action.getName(), 35)); sb.append(" ").append(action.getDescription()).append("\n\n"); } sb.append("-----------------------------------------------------------------------------------------------------------------\n"); return sb.toString(); }
private void handleSettingNameForCmdLineActions() { @SuppressWarnings("unchecked") Map<String, CmdLineAction> beans = appContext .getBeansOfType(CmdLineAction.class); for (Entry<String, CmdLineAction> entry : beans.entrySet()) { entry.getValue().setName(entry.getKey()); } } }
cmdLineArgs.getSpecifiedAction().execute(printer); printActionMessages(printer.getPrintedMessages());
protected String getHeader(CmdLineAction action) { return "** Action Help for '" + action.getName() + "' **"; }
protected String getDescription(CmdLineAction action) { StringBuilder sb = new StringBuilder("> DESCRIPTION:\n"); if (action.getDetailedDescription() != null) { sb.append(" ").append(action.getDetailedDescription() .replaceAll("^\\s*", "").replaceAll("\\s*$", "")); } else if (action.getDescription() != null) { sb.append(" ").append( action.getDescription().replaceAll("^\\s*", "") .replaceAll("\\s*$", "")); } else { sb.append(" - N/A"); } return sb.append("\n").toString(); }
protected String getExamples(CmdLineAction action) { StringBuilder sb = new StringBuilder("> EXAMPLES:\n"); if (action.getExamples() != null) { sb.append(" ").append(action.getExamples().replaceAll("^\\s*", "") .replaceAll("\\s*$", "")); } else { sb.append(" - N/A"); } return sb.toString(); }
public Relation getRelation(CmdLineAction action) { Validate.notNull(actionName); Validate.notNull(relation); Validate.notNull(action); if (action.getName().equals(actionName)) { return relation; } return Relation.NONE; }
public Relation getRelation(CmdLineAction action) { Validate.notNull(actionName); Validate.notNull(relation); Validate.notNull(action); if (action.getName().equals(actionName)) { return relation; } return Relation.NONE; }
public String getArgDescription(CmdLineAction action, CmdLineOption option) { return getArgDescription(action.getName()); } }
/** * Finds a {@link CmdLineAction} by its name. * * @param actionName * Name of {@link CmdLineAction} to find * @param supportedActions * {@link Set} of supported {@link CmdLineAction}s * @return Found {@link CmdLineAction} or null if not found */ public static CmdLineAction findAction(String actionName, Set<CmdLineAction> supportedActions) { Validate.notNull(actionName); Validate.notNull(supportedActions); for (CmdLineAction action : supportedActions) { if (action.getName().equals(actionName)) { return action; } } return null; }
/** * Finds a {@link CmdLineAction} by its name. * * @param actionName * Name of {@link CmdLineAction} to find * @param supportedActions * {@link Set} of supported {@link CmdLineAction}s * @return Found {@link CmdLineAction} or null if not found */ public static CmdLineAction findAction(String actionName, Set<CmdLineAction> supportedActions) { Validate.notNull(actionName); Validate.notNull(supportedActions); for (CmdLineAction action : supportedActions) { if (action.getName().equals(actionName)) { return action; } } return null; }
public String getArgDescription(CmdLineAction action, CmdLineOption option) { return getArgDescription(action.getName()); } }