@Override public CommandInvoker<Void, Object> getInvoker() throws CommandException { List<String> chunks = Utils.chunks(match.getRest()); String[] args = chunks.toArray(new String[chunks.size()]); return GroovyScriptShellCommand.this.getInvoker(args); }
public void open2(final CommandContext<P> consumer) { invocationContext = new InvocationContextImpl<P>(consumer); command.pushContext(invocationContext); command.unmatched = invoker.getMatch().getRest(); }
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; } }
public void open2(final CommandContext<P> consumer) throws CommandException { // invocationContext = new InvocationContextImpl<P>(consumer); // Push context command.pushContext(invocationContext); // Set the unmatched part command.unmatched = invoker.getMatch().getRest(); // PC ret; try { ret = invoker.invoke(this); } catch (org.crsh.cli.impl.SyntaxException e) { throw new CommandException(ErrorKind.SYNTAX, "Syntax exception when executing command " + name, e); } catch (InvocationException e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e.getCause()); } // It's a pipe command if (ret != null) { real = ret; try { real.open(invocationContext); } catch (Exception e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e); } } }
@Override public CommandInvoker<Void, Object> getInvoker() throws CommandException { List<String> chunks = Utils.chunks(match.getRest()); String[] args = chunks.toArray(new String[chunks.size()]); return GroovyScriptShellCommand.this.getInvoker(args); }
@Override public CommandInvoker<Void, Object> getInvoker() throws CommandException { List<String> chunks = Utils.chunks(match.getRest()); String[] args = chunks.toArray(new String[chunks.size()]); return GroovyScriptShellCommand.this.getInvoker(args); }
public void open2(final CommandContext<P> consumer) { invocationContext = new InvocationContextImpl<P>(consumer); command.pushContext(invocationContext); command.unmatched = invoker.getMatch().getRest(); }
public void open2(final CommandContext<P> consumer) { invocationContext = new InvocationContextImpl<P>(consumer); command.pushContext(invocationContext); command.unmatched = invoker.getMatch().getRest(); }
public void open2(final CommandContext<P> consumer) throws CommandException { // invocationContext = new InvocationContextImpl<P>(consumer); // Push context command.pushContext(invocationContext); // Set the unmatched part command.unmatched = invoker.getMatch().getRest(); // PC ret; try { ret = invoker.invoke(this); } catch (org.crsh.cli.impl.SyntaxException e) { throw new CommandException(ErrorKind.SYNTAX, "Syntax exception when executing command " + name, e); } catch (InvocationException e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e.getCause()); } // It's a pipe command if (ret != null) { real = ret; try { real.open(invocationContext); } catch (Exception e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e); } } }
public void open2(final CommandContext<P> consumer) throws CommandException { // invocationContext = new InvocationContextImpl<P>(consumer); // Push context command.pushContext(invocationContext); // Set the unmatched part command.unmatched = invoker.getMatch().getRest(); // PC ret; try { ret = invoker.invoke(this); } catch (org.crsh.cli.impl.SyntaxException e) { throw new CommandException(ErrorKind.SYNTAX, "Syntax exception when executing command " + name, e); } catch (InvocationException e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e.getCause()); } // It's a pipe command if (ret != null) { real = ret; try { real.open(invocationContext); } catch (Exception e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e); } } }
CRaSHCommand.this.unmatched = match.getRest();