public void execute(String[] args) throws IOException {
   FilesystemState table = getState();
   String key = args[1];
   if (table.getWorkingDirectory() == null) {
     getState().getStream().println("no table");
   } else {
     if (table.getValue(key) != null) {
       getState().getStream().println("removed");
       getState().getStream().println(table.removeKey(key));
     } else {
       getState().getStream().println("not found");
     }
   }
 }
예제 #2
0
 public void execute(String[] args) {
   FilesystemState table = getState();
   if (table.getWorkingDirectory() == null) {
     getState().getStream().println("no table");
   } else {
     try {
       if (table.getValue(args[1]) != null) {
         getState().getStream().println("overwrite");
         getState().getStream().println(table.put(args[1], args[2]));
       } else {
         table.put(args[1], args[2]);
         getState().getStream().println("new");
       }
     } catch (ParseException | XMLStreamException e) {
       System.err.println("invalid input: " + e.getMessage());
     }
   }
 }