public Object source(CommandSession session, String script) throws Exception { URI uri = cwd(session).resolve(script); session.put("0", uri); try { return session.execute(readScript(uri)); } finally { session.put("0", null); // API doesn't support remove } }
public Object sh(final CommandSession session, String[] argv) throws Exception { return gosh(session, argv); }
if (login && !opt.isSet("noshutdown")) shutdown(); source(session, uri.toString()); for (String key : getVariables(session)) result = console(newSession); URI script = cwd(session).resolve(args.remove(0)); program = readScript(script); shutdown();
public void cat(CommandSession session, String[] args) throws Exception { if (args.length == 0) { copy(System.in, System.out); return; } URI cwd = Shell.cwd(session); for (String arg : args) { copy(cwd.resolve(arg), System.out); } }
private void startShell(BundleContext context, CommandProcessor processor) { Dictionary<String, Object> dict = new Hashtable<String, Object>(); dict.put(CommandProcessor.COMMAND_SCOPE, "gogo"); // register converters regs.add(context.registerService(Converter.class.getName(), new Converters(context), null)); // register commands dict.put(CommandProcessor.COMMAND_FUNCTION, Builtin.functions); regs.add(context.registerService(Builtin.class.getName(), new Builtin(), dict)); dict.put(CommandProcessor.COMMAND_FUNCTION, Procedural.functions); regs.add(context.registerService(Procedural.class.getName(), new Procedural(), dict)); dict.put(CommandProcessor.COMMAND_FUNCTION, Posix.functions); regs.add(context.registerService(Posix.class.getName(), new Posix(), dict)); dict.put(CommandProcessor.COMMAND_FUNCTION, Telnet.functions); regs.add(context.registerService(Telnet.class.getName(), new Telnet(processor), dict)); shell = new Shell(context, processor); dict.put(CommandProcessor.COMMAND_FUNCTION, Shell.functions); regs.add(context.registerService(Shell.class.getName(), shell, dict)); // start shell session = processor.createSession(System.in, System.out, System.err); thread = new Thread(this, "Gogo shell"); thread.start(); }
for (String key : new TreeSet<>(Shell.getVariables(session)))
if (login && !opt.isSet("noshutdown")) shutdown(); source(session, uri.toString()); for (String key : getVariables(session)) result = console(newSession); URI script = cwd(session).resolve(args.remove(0)); program = readScript(script); shutdown();
public void cat(CommandSession session, String[] args) throws Exception { if (args.length == 0) { copy(System.in, System.out); return; } URI cwd = Shell.cwd(session); for (String arg : args) { copy(cwd.resolve(arg), System.out); } }
private void startShell(BundleContext context, CommandProcessor processor) { Dictionary<String, Object> dict = new Hashtable<String, Object>(); dict.put(CommandProcessor.COMMAND_SCOPE, "gogo"); // register converters regs.add(context.registerService(Converter.class.getName(), new Converters(context), null)); // register commands dict.put(CommandProcessor.COMMAND_FUNCTION, Builtin.functions); regs.add(context.registerService(Builtin.class.getName(), new Builtin(), dict)); dict.put(CommandProcessor.COMMAND_FUNCTION, Procedural.functions); regs.add(context.registerService(Procedural.class.getName(), new Procedural(), dict)); dict.put(CommandProcessor.COMMAND_FUNCTION, Posix.functions); regs.add(context.registerService(Posix.class.getName(), new Posix(), dict)); dict.put(CommandProcessor.COMMAND_FUNCTION, Telnet.functions); regs.add(context.registerService(Telnet.class.getName(), new Telnet(processor), dict)); shell = new Shell(context, processor); dict.put(CommandProcessor.COMMAND_FUNCTION, Shell.functions); regs.add(context.registerService(Shell.class.getName(), shell, dict)); // start shell session = processor.createSession(System.in, System.out, System.err); thread = new Thread(this, "Gogo shell"); thread.start(); }
for (String key : new TreeSet<>(Shell.getVariables(session)))
if (login && !opt.isSet("noshutdown")) shutdown(); source(session, uri.toString()); for (String key : getVariables(session)) result = console(newSession); URI script = cwd(session).resolve(args.remove(0)); program = readScript(script); shutdown();
public Object source(CommandSession session, String script) throws Exception { URI uri = cwd(session).resolve(script); session.put("0", uri); try { return session.execute(readScript(uri)); } finally { session.put("0", null); // API doesn't support remove } }
public void cat(CommandSession session, String[] args) throws Exception { if (args.length == 0) { copy(System.in, System.out); return; } URI cwd = Shell.cwd(session); for (String arg : args) { copy(cwd.resolve(arg), System.out); } }
public Object sh(final CommandSession session, String[] argv) throws Exception { return gosh(session, argv); }
private void startShell(BundleContext context, CommandProcessor processor) { Dictionary<String, Object> dict = new Hashtable<>(); dict.put(CommandProcessor.COMMAND_SCOPE, "gogo"); Set<ServiceRegistration<?>> currentRegs = new HashSet<>(); // register converters currentRegs.add(context.registerService(Converter.class.getName(), new Converters(context.getBundle(0).getBundleContext()), null)); // register commands dict.put(CommandProcessor.COMMAND_FUNCTION, Builtin.functions); currentRegs.add(context.registerService(Builtin.class.getName(), new Builtin(), dict)); dict.put(CommandProcessor.COMMAND_FUNCTION, Procedural.functions); currentRegs.add(context.registerService(Procedural.class.getName(), new Procedural(), dict)); dict.put(CommandProcessor.COMMAND_FUNCTION, Posix.functions); currentRegs.add(context.registerService(Posix.class.getName(), new Posix(), dict)); dict.put(CommandProcessor.COMMAND_FUNCTION, Telnet.functions); currentRegs.add(context.registerService(Telnet.class.getName(), new Telnet(processor), dict)); Shell shell = new Shell(context, processor); dict.put(CommandProcessor.COMMAND_FUNCTION, Shell.functions); currentRegs.add(context.registerService(Shell.class.getName(), shell, dict)); synchronized (regs) { regs.addAll(currentRegs); currentRegs.clear(); } // start shell on a separate thread... executor = Executors.newSingleThreadExecutor(runnable -> new Thread(runnable, "Gogo shell")); shellJob = new StartShellJob(context, processor); executor.submit(shellJob); }
for (String key : new TreeSet<String>(Shell.getVariables(session)))
if (login && !opt.isSet("noshutdown")) shutdown(); source(session, uri.toString()); for (String key : getVariables(session)) result = console(newSession); URI script = cwd(session).resolve(args.remove(0)); program = readScript(script); shutdown();
public Object source(CommandSession session, String script) throws Exception { URI uri = cwd(session).resolve(script); session.put("0", uri); try { return session.execute(readScript(uri)); } finally { session.put("0", null); // API doesn't support remove } }
public void cat(CommandSession session, String[] args) throws Exception { if (args.length == 0) { copy(System.in, System.out); return; } URI cwd = Shell.cwd(session); for (String arg : args) { copy(cwd.resolve(arg), System.out); } }
public Object sh(final CommandSession session, String[] argv) throws Exception { return gosh(session, argv); }