for (InvocationMatch<T> current = match;current != null && helpDesc == null;current = current.owner()) { helpDesc = current.getParameter(HELP_OPTION);
bind(match.owner(), owner.getParameters(), command, Util.EMPTY_ARGS);
private <T> Test(Class<T> type, String s) { try { CommandDescriptor<Instance<T>> command = CommandFactory.DEFAULT.create(type); InvocationMatcher<Instance<T>> parser = command.matcher(); InvocationMatch<Instance<T>> match = parser.parse(s); // if (match.owner() == null) { this.sharedOptionMatches = new LinkedList<OptionMatch>(); this.optionMatches = new LinkedList<OptionMatch>(match.options()); this.argumentMatches = new LinkedList<ArgumentMatch>(match.arguments()); this.rest = match.getRest(); this.methodName = null; } else { this.sharedOptionMatches = new LinkedList<OptionMatch>(match.owner().options()); this.optionMatches = new LinkedList<OptionMatch>(match.options()); this.argumentMatches = new LinkedList<ArgumentMatch>(match.arguments()); this.rest = match.getRest(); this.methodName = match.getDescriptor().getName(); } } catch (Exception e) { AssertionFailedError afe = new AssertionFailedError(); afe.initCause(e); throw afe; } }
@Override public Object invoke(Resolver resolver, T command) throws InvocationException, SyntaxException { // Get the option from the top match ParameterMatch<OptionDescriptor> help = null; for (InvocationMatch<T> current = match;current != null && help == null;current = current.owner()) { help = current.getParameter(HELP_OPTION); } // if (help == null && invoker != null) { return invoker.invoke(resolver, command); } else { return new Help<T>(delegate); } } };
for (InvocationMatch<T> current = match;current != null && helpDesc == null;current = current.owner()) { helpDesc = current.getParameter(HELP_OPTION);
bind(match.owner(), owner.getParameters(), command, Util.EMPTY_ARGS);
owner.configure(_match.owner(), command);