@Override public Object execute(Session session, List<Object> arguments) throws Exception { Action action = createNewAction(session); try { if (new DefaultActionPreparator().prepare(action, session, arguments)) { return action.execute(); } } finally { releaseAction(action); } return null; }
private String loadDescription(Class<?> clazz, String desc) { if (desc != null && desc.startsWith("classpath:")) { desc = loadClassPathResource(clazz, desc.substring("classpath:".length())); } return desc; }
out.print(" "); out.println(INTENSITY_BOLD + argument.name() + INTENSITY_NORMAL); printFormatted(" ", argument.description(), termWidth, out, true); if (!argument.required()) { if (argument.valueToShowInHelp() != null && argument.valueToShowInHelp().length() != 0) { if (Argument.DEFAULT_STRING.equals(argument.valueToShowInHelp())) { Object o = getDefaultValue(action, arguments.get(argument)); String defaultValue = getDefaultValueString(o); if (defaultValue != null) { printDefaultsTo(out, defaultValue); printDefaultsTo(out, argument.valueToShowInHelp()); printMeta(out, argument.required(), argument.multiValued()); printFormatted(" ", option.description(), termWidth, out, true); if (option.valueToShowInHelp() != null && option.valueToShowInHelp().length() != 0) { if (Option.DEFAULT_STRING.equals(option.valueToShowInHelp())) { Object o = getDefaultValue(action, options.get(option)); String defaultValue = getDefaultValueString(o); if (defaultValue != null) { printDefaultsTo(out, defaultValue); } else { printMeta(out, option.required(), option.multiValued()); printDefaultsTo(out, option.valueToShowInHelp()); printMeta(out, option.required(), option.multiValued());
argument = replaceDefaultArgument(field, argument); arguments.put(argument, field); int index = argument.index(); assertIndexesAreCorrect(action.getClass(), orderedArguments); termWidth = termWidth == 0 ? 80 : termWidth; boolean globalScope = NameScoping.isGlobalScope(session, command.scope()); printUsage(action, options, arguments, System.out, globalScope, termWidth); return false; Object value; try { value = convert(action, entry.getValue(), field.getGenericType()); } catch (Exception e) { throw new CommandException(commandErrorSt + Object value; try { value = convert(action, entry.getValue(), field.getGenericType()); } catch (Exception e) { throw new CommandException(commandErrorSt +
out.print(" "); out.println(INTENSITY_BOLD + argument.name() + INTENSITY_NORMAL); printFormatted(" ", argument.description(), termWidth, out, true); if (!argument.required()) { if (argument.valueToShowInHelp() != null && argument.valueToShowInHelp().length() != 0) { if (Argument.DEFAULT_STRING.equals(argument.valueToShowInHelp())) { Object o = getDefaultValue(action, arguments.get(argument)); String defaultValue = getDefaultValueString(o); if (defaultValue != null) { printDefaultsTo(out, defaultValue); printDefaultsTo(out, argument.valueToShowInHelp()); printMeta(out, argument.required(), argument.multiValued()); printFormatted(" ", option.description(), termWidth, out, true); if (option.valueToShowInHelp() != null && option.valueToShowInHelp().length() != 0) { if (Option.DEFAULT_STRING.equals(option.valueToShowInHelp())) { Object o = getDefaultValue(action, options.get(option)); String defaultValue = getDefaultValueString(o); if (defaultValue != null) { printDefaultsTo(out, defaultValue); } else { printMeta(out, option.required(), option.multiValued()); printDefaultsTo(out, option.valueToShowInHelp()); printMeta(out, option.required(), option.multiValued());
argument = replaceDefaultArgument(field, argument); arguments.put(argument, field); int index = argument.index(); assertIndexesAreCorrect(action.getClass(), orderedArguments); termWidth = termWidth == 0 ? 80 : termWidth; boolean globalScope = NameScoping.isGlobalScope(session, command.scope()); printUsage(action, options, arguments, System.out, globalScope, termWidth); return false; Object value; try { value = convert(action, entry.getValue(), field.getGenericType()); } catch (Exception e) { throw new CommandException(commandErrorSt + Object value; try { value = convert(action, entry.getValue(), field.getGenericType()); } catch (Exception e) { throw new CommandException(commandErrorSt +
@Override public Object execute(Session session, List<Object> arguments) throws Exception { Action action = createNewAction(session); try { if (new DefaultActionPreparator().prepare(action, session, arguments)) { return action.execute(); } } finally { releaseAction(action); } return null; }
private String loadDescription(Class<?> clazz, String desc) { if (desc != null && desc.startsWith("classpath:")) { desc = loadClassPathResource(clazz, desc.substring("classpath:".length())); } return desc; }
static void execute(InstanceCommandSupport command, File storageFile, String[] args) throws Exception { DefaultActionPreparator dap = new DefaultActionPreparator(); List<Object> params = new ArrayList<>(Arrays.asList(args)); params.remove(0); // this is the actual command name if (!dap.prepare(command, null, params)) { return; } InstanceServiceImpl instanceService = new InstanceServiceImpl(); instanceService.setStorageLocation(storageFile); command.setInstanceService(instanceService); command.execute(); }
static void execute(InstanceCommandSupport command, File storageFile, String[] args) throws Exception { DefaultActionPreparator dap = new DefaultActionPreparator(); List<Object> params = new ArrayList<>(Arrays.asList(args)); params.remove(0); // this is the actual command name if (!dap.prepare(command, null, params)) { return; } InstanceServiceImpl instanceService = new InstanceServiceImpl(); instanceService.setStorageLocation(storageFile); command.setInstanceService(instanceService); command.execute(); }