public Map<String, String> getCommandsNameHelp() { Map<String, String> commandsNameHelp = new TreeMap<String, String>(); for (CommandTarget commandTarget : commandTargets) { commandsNameHelp.put(commandTarget.getCommandName(), commandTarget.getCommandHelp()); } return commandsNameHelp; }
public Map<String, String> getCommandsNameHelp() { Map<String, String> commandsNameHelp = new TreeMap<String, String>(); for (CommandTarget commandTarget : commandTargets) { commandsNameHelp.put(commandTarget.getCommandName(), commandTarget.getCommandHelp()); } return commandsNameHelp; }
public static void registerCommand(CommandManager cmdManager, Method method, CommandTarget commandTarget){ //Save command manager instance and create a local parser for parsing the commands if(commandManager==null){ commandManager = cmdManager; parser = new GfshParser(cmdManager); } boolean found=false; Annotation ans[] = method.getDeclaredAnnotations(); for(Annotation an : ans){ if(an instanceof ResourceOperation) { cache(commandTarget.getCommandName(),(ResourceOperation)an); found=true; } } if(!found) cache(commandTarget.getCommandName(),null); }
String commandName = commandTarget.getCommandName();
String commandName = commandTarget.getCommandName();
public List<String> obtainHelpCommandNames(String userInput) { List<String> commandNames = new ArrayList<String>(); try { if (userInput == null) { userInput = ""; } List<CommandTarget> commandTargets = new ArrayList<CommandTarget>(); Map<Short, List<CommandTarget>> matchingCommandsMap = findMatchingCommands(userInput, null); commandTargets.addAll(matchingCommandsMap.get(EXACT_TARGET)); commandTargets.addAll(matchingCommandsMap.get(MATCHING_TARGETS)); for (CommandTarget commandTarget : commandTargets) { commandNames.add(commandTarget.getCommandName()); } } catch (IllegalArgumentException e) { logWrapper.warning(CliUtil.stackTraceAsString(e)); } catch (IllegalAccessException e) { logWrapper.warning(CliUtil.stackTraceAsString(e)); } catch (InvocationTargetException e) { logWrapper.warning(CliUtil.stackTraceAsString(e)); } return commandNames; }
private List<Option> getUnspecifiedOptionsWithMode(List<Option> unspecifiedOptions, CommandTarget commandTarget, Map<String, Option> optionsPresentMap) { Collection<CommandMode> cmodes = CommandModes.getInstance().getCommandModes(commandTarget.getCommandName()); if (cmodes != null) { List<Option> filteredList = new ArrayList<Option>(); CommandMode defaultMode = CommandModes.getInstance().getCommandMode(commandTarget.getCommandName(), CommandModes.DEFAULT_MODE); for (String opt : defaultMode.options) {
public List<String> obtainHelpCommandNames(String userInput) { List<String> commandNames = new ArrayList<String>(); try { if (userInput == null) { userInput = ""; } List<CommandTarget> commandTargets = new ArrayList<CommandTarget>(); Map<Short, List<CommandTarget>> matchingCommandsMap = findMatchingCommands(userInput, null); commandTargets.addAll(matchingCommandsMap.get(EXACT_TARGET)); commandTargets.addAll(matchingCommandsMap.get(MATCHING_TARGETS)); for (CommandTarget commandTarget : commandTargets) { commandNames.add(commandTarget.getCommandName()); } } catch (IllegalArgumentException e) { logWrapper.warning(CliUtil.stackTraceAsString(e)); } catch (IllegalAccessException e) { logWrapper.warning(CliUtil.stackTraceAsString(e)); } catch (InvocationTargetException e) { logWrapper.warning(CliUtil.stackTraceAsString(e)); } return commandNames; }
for (int i = 0; i < matchingCommandTargets.size(); i++) { CommandTarget commandTarget = matchingCommandTargets.get(i); helpText.append(commandTarget.getCommandName()); if (i < matchingCommandTargets.size() - 1) { helpText.append(", "); String availability = commandTarget.isAvailable() ? HelpUtils.HELP__COMMAND_AVAILABLE : HelpUtils.HELP__COMMAND_NOTAVAILABLE; helpText.append(commandTarget.getCommandName()); if (withinShell) { helpText.append(" (").append(availability).append(")");
for (int i = 0; i < matchingCommandTargets.size(); i++) { CommandTarget commandTarget = matchingCommandTargets.get(i); helpText.append(commandTarget.getCommandName()); if (i < matchingCommandTargets.size() - 1) { helpText.append(", "); String availability = commandTarget.isAvailable() ? HelpUtils.HELP__COMMAND_AVAILABLE : HelpUtils.HELP__COMMAND_NOTAVAILABLE; helpText.append(commandTarget.getCommandName()); if (withinShell) { helpText.append(" (").append(availability).append(")");
throws CliCommandMultiModeOptionException { CommandModes modes = CommandModes.getInstance(); Collection<CommandMode> cmodes = modes.getCommandModes(commandTarget.getCommandName()); CommandMode defaultMode = modes.getCommandMode(commandTarget.getCommandName(), CommandModes.DEFAULT_MODE); Map<String, Option> userOptions = new HashMap<String, Option>(); Map<String, CommandMode> loToModeMap = new HashMap<String, CommandMode>();
if (commandTarget.getCommandName() != null) { return false; } else if (!commandName.equals(commandTarget.getCommandName())) { return false;
if (commandTarget.getCommandName() != null) { return false; } else if (!commandName.equals(commandTarget.getCommandName())) { return false;
List<Block> blocks = new ArrayList<Block>(); blocks.add(block(NAME_NAME, row(commandTarget.getCommandName()))); buffer.append(commandTarget.getCommandName());
List<Block> blocks = new ArrayList<Block>(); blocks.add(block(NAME_NAME, row(commandTarget.getCommandName()))); buffer.append(commandTarget.getCommandName());
name.addChild(new DataNode(commandTarget.getCommandName(), null)); root.addChild(name); if (withinShell) {// include availabilty info buffer.append(commandTarget.getCommandName()); } else { // add app name in the syntax buffer.append(EXE_PREFIX_FOR_EXTERNAL_HELP).append(commandTarget.getCommandName()); CommandModes modes = CommandModes.getInstance(); Collection<CommandMode> comModes = modes.getCommandModes(commandTarget .getCommandName()); DataNode modesDN = new DataNode(MODES, new ArrayList<DataNode>()); if (comModes != null) { List<Option> optionalOptions = new ArrayList<Option>(); sb.append(commandTarget.getCommandName()).append(" "); if(!cmd.name.equals("default")) appendRequiredOption(sb, getOption(commandTarget, cmd.leadOption));
name.addChild(new DataNode(commandTarget.getCommandName(), null)); root.addChild(name); if (withinShell) {// include availabilty info buffer.append(commandTarget.getCommandName()); } else { // add app name in the syntax buffer.append(EXE_PREFIX_FOR_EXTERNAL_HELP).append(commandTarget.getCommandName());
methodParameters, userInput, commandTarget.getCommandName() , paramValMap); } else { if (coe != null) { CommandTarget commandTarget = locateExactMatchingTarget(userInput); if (commandTarget != null) { String commandName = commandTarget.getCommandName(); AvailabilityTarget availabilityIndicator = commandTarget.getAvailabilityIndicator(); message = CliStrings.format(CliStrings.GFSHPARSER__MSG__0_IS_NOT_AVAILABLE_REASON_1, new Object[] {
CommandTarget commandTarget = locateExactMatchingTarget(userInput); if (commandTarget != null) { String commandName = commandTarget.getCommandName(); AvailabilityTarget availabilityIndicator = commandTarget.getAvailabilityIndicator(); message = CliStrings.format(CliStrings.GFSHPARSER__MSG__0_IS_NOT_AVAILABLE_REASON_1, new Object[] {commandName, availabilityIndicator.getAvailabilityDescription()});