+++ /dev/null
-package org.ibex.xt.shell;
-
-import java.io.IOException;
-
-public abstract class Env {
- /** Current JS path using '.' as a seperator. */
- public String path = "";
-
- public Command[] commands = new Command[0];
-
- /** Returns the command matching the given name. */
- public Command command(String name) {
- for (int i=0; i < commands.length; i++)
- if (commands[i].name().equals(name)) return commands[i];
- return null;
- }
-
- /** Returns a path, based on console-style representation. */
- public String path(String c) {
- if (c.equals("") || c.equals(".")) {
- c = ".";
- } else if (c.equals("..")) {
- c = path;
- c = c.substring(0, c.lastIndexOf('.'));
- if (c.equals("")) c = ".";
- } else {
- if (c.charAt(0) != '.') c = path + "." + c;
- if (c.length() > 1 && c.charAt(c.length() - 1) == '.')
- c = c.substring(0, c.length() - 1);
- }
- return c;
- }
-
- public abstract Request.Response send(Request request) throws IOException;
-}