import org.apache.commons.cli.*;
public class GetOptExample {
public static void main(String[] args) {
Getopt getopt = new Getopt("example", "abc:de:f:", "Convert to upper case");
int option;
while ((option = getopt.getopt(args, "abc:de:f:")) != -1) {
switch (option) {
case 'a':
System.out.println("Option a");
break;
case 'b':
System.out.println("Option b");
break;
case 'c':
System.out.println("Option c with value " + getopt.getOptarg());
break;
case 'd':
System.out.println("Option d with value " + getopt.getOptarg());
break;
case 'f':
System.out.println("Option f with value " + getopt.getOptarg());
break;
default:
System.out.println("Unknown option");
}
}
getopt.getoptargs();
}
}