/** * The underlying groovu shell used for the REPL. * * @return a groovy shell operating on the session attributes */ public static GroovyShell getGroovyShell(ShellSession session) { GroovyShell shell = (GroovyShell)session.get("shell"); if (shell == null) { CompilerConfiguration config = new CompilerConfiguration(); config.setRecompileGroovySource(true); ShellBinding binding = new ShellBinding(session, session); shell = new GroovyShell(session.getContext().getLoader(), binding, config); session.put("shell", shell); } return shell; }
public void testWelcomeNoClosure() { Object welcome = session.remove("welcome"); try { String s = shell.getWelcome(); assertNotNull(s); } finally { session.put("welcome", welcome); } }
public void testPromptNoClosure() { Object prompt = session.remove("prompt"); try { String s = shell.getPrompt(); assertNotNull(s); } finally { session.put("prompt", prompt); } } }
public void testSessionAccess() { lifeCycle.bindClass("complete", Commands.CompleteWithSession.class); session.put("juu", "juu_value"); CompletionMatch completionMatch = assertComplete("complete foo"); Completion completion = completionMatch.getValue(); assertEquals("foo", completion.getPrefix()); assertEquals(Collections.singleton("juu_value"), completion.getValues()); assertTrue(completion.get("juu_value")); } }
/** * The underlying groovu shell used for the REPL. * * @return a groovy shell operating on the session attributes */ public static GroovyShell getGroovyShell(ShellSession session) { GroovyShell shell = (GroovyShell)session.get("shell"); if (shell == null) { CompilerConfiguration config = new CompilerConfiguration(); config.setRecompileGroovySource(true); ShellBinding binding = new ShellBinding(session, session); shell = new GroovyShell(session.getContext().getLoader(), binding, config); session.put("shell", shell); } return shell; }
/** * The underlying groovu shell used for the REPL. * * @return a groovy shell operating on the session attributes */ public static GroovyShell getGroovyShell(ShellSession session) { GroovyShell shell = (GroovyShell)session.get("shell"); if (shell == null) { CompilerConfiguration config = new CompilerConfiguration(); config.setRecompileGroovySource(true); ShellBinding binding = new ShellBinding(session, session); shell = new GroovyShell(session.getContext().getLoader(), binding, config); session.put("shell", shell); } return shell; }