Package org.codehaus.groovy.tools.shell

Examples of org.codehaus.groovy.tools.shell.CommandRegistry


    Groovysh shell = new Groovysh();

    // Install our error hook (exception handling)
    shell.setErrorHook(new MethodClosure(ThrowableDisplayer.class, "errorHook"));

    CommandRegistry registry = shell.getRegistry();
    @SuppressWarnings("unchecked")
    Iterator<Command> iterator = registry.iterator();
    while (iterator.hasNext()) {
      Command command = iterator.next();
      if (!commandsToKeep.contains(command.getName())) {
        iterator.remove();
        // remove from "names" set to avoid duplicate error.
        registry.remove(command);
      }
    }

    shell.register(new HelpCommand(shell));
    shell.register(new SetCommand(shell));
View Full Code Here


    // Install our error hook (exception handling)
    shell.setErrorHook(
      new MethodClosure(ThrowableDisplayer.class, "errorHook"));
    ThrowableDisplayer.setIo(shell.getIo());

    CommandRegistry registry = shell.getRegistry();
    @SuppressWarnings("unchecked")
    Iterator<Command> iterator = registry.iterator();
    while (iterator.hasNext()) {
      Command command = iterator.next();
      if (!commandsToKeep.contains(command.getName())) {
        iterator.remove();
        // remove from "names" set to avoid duplicate error.
        registry.remove(command);
      }
    }

    shell.register(new HelpCommand(shell));
    shell.register(new SetCommand(shell));
View Full Code Here

    Groovysh shell = new Groovysh();

    // Install our error hook (exception handling)
    shell.setErrorHook(new MethodClosure(ThrowableDisplayer.class, "errorHook"));

    CommandRegistry registry = shell.getRegistry();
    @SuppressWarnings("unchecked")
    Iterator<Command> iterator = registry.iterator();
    while (iterator.hasNext()) {
      Command command = iterator.next();
      if (!commandsToKeep.contains(command.getName())) {
        iterator.remove();
        // remove from "names" set to avoid duplicate error.
        registry.remove(command);
      }
    }

    shell.register(new HelpCommand(shell));
    shell.register(new SetCommand(shell));
View Full Code Here

TOP

Related Classes of org.codehaus.groovy.tools.shell.CommandRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.