1 22 package org.netbeans.lib.cvsclient.commandLine.command; 23 24 import java.io.*; 25 26 import org.netbeans.lib.cvsclient.command.*; 27 import org.netbeans.lib.cvsclient.command.update.*; 28 import org.netbeans.lib.cvsclient.commandLine.*; 29 30 34 public class update extends AbstractCommandProvider { 35 36 public String [] getSynonyms() { 37 return new String [] { "up", "upd" }; } 39 40 public Command createCommand(String [] args, int index, GlobalOptions gopt, String workDir) { 41 UpdateCommand command = new UpdateCommand(); 42 command.setBuilder(null); 43 final String getOptString = command.getOptString(); 44 GetOpt go = new GetOpt(args, getOptString); 45 int ch = -1; 46 go.optIndexSet(index); 47 boolean usagePrint = false; 48 while ((ch = go.getopt()) != go.optEOF) { 49 boolean ok = command.setCVSCommand((char)ch, go.optArgGet()); 50 61 if (!ok) { 62 usagePrint = true; 63 } 64 } 65 if (usagePrint) { 66 throw new IllegalArgumentException (getUsage()); 67 } 68 int fileArgsIndex = go.optIndexGet(); 69 if (fileArgsIndex < args.length) { 71 File[] fileArgs = new File[args.length - fileArgsIndex]; 72 if (workDir == null) { 74 workDir = System.getProperty("user.dir"); 75 } 76 File workingDir = new File(workDir); 77 for (int i = fileArgsIndex; i < args.length; i++) { 78 fileArgs[i - fileArgsIndex] = new File(workingDir, args[i]); 79 } 80 command.setFiles(fileArgs); 81 } 82 return command; 83 } 84 85 } | Popular Tags |