I have the below command line arguments set for the program. argument proc is mandatory argument chgval is optional and argument inputfile is optional.
./test.sh -proc mode1 -chval a -inputfile b.csv
I need to modify the below function so that either one of the optional argument should exists in command line arguments along with the mandatory argument proc . If i have the two optional arguments chval , inputfile in the command line along with the mandatory argument proc it's allowing now. I dont want it to happen it should throw an error.
Listed the valid values below and the rest should be an error
./test.sh -proc mode1 -chval a
./test.sh -proc mode1 -inputfile b.csv
./test.sh -proc mode1
public static Options usage() {
Option proc = OptionBuilder.withArgName("proc")
.hasArg()
.isRequired()
.withDescription("Process Mode for testing:")
.create("proc");
Option chgval = OptionBuilder.withArgName("chgval")
.hasArg()
.withDescription("chg eeds to be Processed")
.create("chgval");
Option inputFile = OptionBuilder.withArgName("inputfile")
.hasArg()
.withDescription("Name of the input file")
.create("inputfile");
Options options = new Options();
options.addOption(proc);
options.addOption(chgval);
options.addOption(inputFile);
return options;
}
What needs to be modified?