public static void main(String[] args) throws IOException { if (args.length != 0) { MVEL.evalFile(new File(args[0])); } else { showSplash(); new ShellSession().run(); } }
public void run() { final BufferedReader readBuffer = new BufferedReader(new InputStreamReader(System.in)); try { //noinspection InfiniteLoopStatement while (true) { printPrompt(); if (commandBuffer == null) { commandBuffer = readBuffer.readLine(); } _exec(); } } catch (Exception e) { e.printStackTrace(); System.out.println("unexpected exception. exiting."); } }
public ShellSession(String init) { this(); exec(init); }
public Object execute(ShellSession session, String[] args) { session.setCtxObject(MVEL.eval(args[0], session.getCtxObject(), session.getVariables())); return "Changed Context"; }
public Object execute(ShellSession session, String[] args) { System.out.println(session.getEnv().get("$CWD")); return null; }
public void printPrompt() { if (!multi) { multiIndentSize = (prompt = String.valueOf(TemplateRuntime.eval(env.get("$PROMPT"), variables))).length(); out.append(prompt); } else { out.append(">").append(indent((multiIndentSize - 1) + (depth * 4))); } }
public Object execute(ShellSession session, String[] args) { boolean values = false; Map<String, Object> vars = session.getVariables(); for (int i = 0; i < args.length; i++) { if ("-values".equals(args[i])) values = true; else throw new CommandException("unknown argument: " + args[i]); } System.out.println("Printing Variables ..."); if (values) { for (String key : vars.keySet()) { System.out.println(key + " => " + String.valueOf(vars.get(key))); } } else { for (String key : vars.keySet()) { System.out.println(key); } } System.out.println(" ** " + vars.size() + " variables total."); return null; }
public void exec(String command) { for (String c : command.split("\n")) { inBuffer.append(c); _exec(); } }
public Object execute(ShellSession session, String[] args) { for (String command : session.getCommands().keySet()) { System.out.println(command + pad(command.length(), 25) + "- " + session.getCommands().get(command).getDescription()); } return null; }
public Object execute(ShellSession session, String[] args) { session.setCtxObject(MVEL.eval(args[0], session.getCtxObject(), session.getVariables())); return "Changed Context"; }
public Object execute(ShellSession session, String[] args) { System.out.println(session.getEnv().get("$CWD")); return null; }
public void printPrompt() { if (!multi) { multiIndentSize = (prompt = String.valueOf(TemplateRuntime.eval(env.get("$PROMPT"), variables))).length(); out.append(prompt); } else { out.append(">").append(indent((multiIndentSize - 1) + (depth * 4))); } }
public Object execute(ShellSession session, String[] args) { boolean values = false; Map<String, Object> vars = session.getVariables(); for (int i = 0; i < args.length; i++) { if ("-values".equals(args[i])) values = true; else throw new CommandException("unknown argument: " + args[i]); } System.out.println("Printing Variables ..."); if (values) { for (String key : vars.keySet()) { System.out.println(key + " => " + String.valueOf(vars.get(key))); } } else { for (String key : vars.keySet()) { System.out.println(key); } } System.out.println(" ** " + vars.size() + " variables total."); return null; }
public void exec(String command) { for (String c : command.split("\n")) { inBuffer.append(c); _exec(); } }
public Object execute(ShellSession session, String[] args) { for (String command : session.getCommands().keySet()) { System.out.println(command + pad(command.length(), 25) + "- " + session.getCommands().get(command).getDescription()); } return null; }
public Object execute(ShellSession session, String[] args) { session.setCtxObject(MVEL.eval(args[0], session.getCtxObject(), session.getVariables())); return "Changed Context"; }
public static void main(String[] args) throws IOException { if (args.length != 0) { MVEL.evalFile(new File(args[0])); } else { showSplash(); new ShellSession().run(); } }
public Object execute(ShellSession session, String[] args) { System.out.println(session.getEnv().get("$CWD")); return null; }
public void run() { final BufferedReader readBuffer = new BufferedReader(new InputStreamReader(System.in)); try { //noinspection InfiniteLoopStatement while (true) { printPrompt(); if (commandBuffer == null) { commandBuffer = readBuffer.readLine(); } _exec(); } } catch (Exception e) { e.printStackTrace(); System.out.println("unexpected exception. exiting."); } }
public void printPrompt() { if (!multi) { multiIndentSize = (prompt = String.valueOf(TemplateRuntime.eval(env.get("$PROMPT"), variables))).length(); out.append(prompt); } else { out.append(">").append(indent((multiIndentSize - 1) + (depth * 4))); } }