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.status.*; 28 import org.netbeans.lib.cvsclient.commandLine.*; 29 30 34 public class status extends AbstractCommandProvider { 35 36 public String [] getSynonyms() { 37 return new String [] { "st", "stat" }; } 39 40 public Command createCommand(String [] args, int index, GlobalOptions gopt, String workDir) { 41 StatusCommand command = new StatusCommand(); 42 final String getOptString = command.getOptString(); 43 GetOpt go = new GetOpt(args, getOptString); 44 int ch = -1; 45 go.optIndexSet(index); 46 boolean usagePrint = false; 47 while ((ch = go.getopt()) != go.optEOF) { 48 boolean ok = command.setCVSCommand((char)ch, go.optArgGet()); 49 58 if (!ok) { 59 usagePrint = true; 60 } 61 } 62 if (usagePrint) { 63 throw new IllegalArgumentException (getUsage()); 64 } 65 int fileArgsIndex = go.optIndexGet(); 66 if (fileArgsIndex < args.length) { 68 File[] fileArgs = new File[args.length - fileArgsIndex]; 69 if (workDir == null) { 71 workDir = System.getProperty("user.dir"); 72 } 73 File workingDir = new File(workDir); 74 for (int i = fileArgsIndex; i < args.length; i++) { 75 fileArgs[i - fileArgsIndex] = new File(workingDir, args[i]); 76 } 77 command.setFiles(fileArgs); 78 } 79 return command; 80 } 81 82 } | Popular Tags |