74 void process(Main tool, String opt, String arg) throws BadArgs {
75 if (tool.cflag || tool.iflag || tool.uflag || tool.xflag || tool.printModuleDescriptor)
76 throw new BadArgs("error.multiple.main.operations").showUsage(true);
77 tool.tflag = true;
78 }
79 },
80 new Option(false, OptionType.MAIN_OPERATION, "--update", "-u") {
81 void process(Main tool, String opt, String arg) throws BadArgs {
82 if (tool.cflag || tool.iflag || tool.tflag || tool.xflag || tool.printModuleDescriptor)
83 throw new BadArgs("error.multiple.main.operations").showUsage(true);
84 tool.uflag = true;
85 }
86 },
87 new Option(false, OptionType.MAIN_OPERATION, "--extract", "-x") {
88 void process(Main tool, String opt, String arg) throws BadArgs {
89 if (tool.cflag || tool.iflag || tool.tflag || tool.uflag || tool.printModuleDescriptor)
90 throw new BadArgs("error.multiple.main.operations").showUsage(true);
91 tool.xflag = true;
92 }
93 },
94 new Option(false, OptionType.MAIN_OPERATION, "--print-module-descriptor", "-p") {
95 void process(Main tool, String opt, String arg) throws BadArgs {
96 if (tool.cflag || tool.iflag || tool.tflag || tool.uflag || tool.xflag)
97 throw new BadArgs("error.multiple.main.operations").showUsage(true);
98 tool.printModuleDescriptor = true;
99 }
100 },
101
102 // Additional options
103 new Option(true, OptionType.ANY, "--file", "-f") {
104 void process(Main jartool, String opt, String arg) {
105 jartool.fname = arg;
106 }
107 },
108 new Option(false, OptionType.ANY, "--verbose", "-v") {
109 void process(Main jartool, String opt, String arg) {
110 jartool.vflag = true;
111 }
112 },
113 new Option(false, OptionType.CREATE, "--normalize", "-n") {
114 void process(Main jartool, String opt, String arg) {
128 },
129 new Option(false, OptionType.CREATE_UPDATE, "--no-manifest", "-M") {
130 void process(Main jartool, String opt, String arg) {
131 jartool.Mflag = true;
132 }
133 },
134 new Option(true, OptionType.CREATE_UPDATE, "--module-version") {
135 void process(Main jartool, String opt, String arg) {
136 jartool.moduleVersion = Version.parse(arg);
137 }
138 },
139 new Option(true, OptionType.CREATE_UPDATE, "--hash-modules") {
140 void process(Main jartool, String opt, String arg) throws BadArgs {
141 try {
142 jartool.modulesToHash = Pattern.compile(arg);
143 } catch (PatternSyntaxException e) {
144 throw new BadArgs("err.badpattern", arg).showUsage(true);
145 }
146 }
147 },
148 new Option(true, OptionType.CREATE_UPDATE, "--modulepath", "--mp") {
149 void process(Main jartool, String opt, String arg) {
150 String[] dirs = arg.split(File.pathSeparator);
151 Path[] paths = new Path[dirs.length];
152 int i = 0;
153 for (String dir : dirs) {
154 paths[i++] = Paths.get(dir);
155 }
156 jartool.moduleFinder = ModuleFinder.compose(jartool.moduleFinder,
157 ModuleFinder.of(paths));
158 }
159 },
160 new Option(false, OptionType.CREATE_UPDATE_INDEX, "--no-compress", "-0") {
161 void process(Main jartool, String opt, String arg) {
162 jartool.flag0 = true;
163 }
164 },
165
166 // Hidden options
167 new Option(false, OptionType.OTHER, "-P") {
168 void process(Main jartool, String opt, String arg) {
|
74 void process(Main tool, String opt, String arg) throws BadArgs {
75 if (tool.cflag || tool.iflag || tool.uflag || tool.xflag || tool.printModuleDescriptor)
76 throw new BadArgs("error.multiple.main.operations").showUsage(true);
77 tool.tflag = true;
78 }
79 },
80 new Option(false, OptionType.MAIN_OPERATION, "--update", "-u") {
81 void process(Main tool, String opt, String arg) throws BadArgs {
82 if (tool.cflag || tool.iflag || tool.tflag || tool.xflag || tool.printModuleDescriptor)
83 throw new BadArgs("error.multiple.main.operations").showUsage(true);
84 tool.uflag = true;
85 }
86 },
87 new Option(false, OptionType.MAIN_OPERATION, "--extract", "-x") {
88 void process(Main tool, String opt, String arg) throws BadArgs {
89 if (tool.cflag || tool.iflag || tool.tflag || tool.uflag || tool.printModuleDescriptor)
90 throw new BadArgs("error.multiple.main.operations").showUsage(true);
91 tool.xflag = true;
92 }
93 },
94 new Option(false, OptionType.MAIN_OPERATION, "--print-module-descriptor", "-d") {
95 void process(Main tool, String opt, String arg) throws BadArgs {
96 if (tool.cflag || tool.iflag || tool.tflag || tool.uflag || tool.xflag)
97 throw new BadArgs("error.multiple.main.operations").showUsage(true);
98 tool.printModuleDescriptor = true;
99 }
100 },
101
102 // Additional options
103 new Option(true, OptionType.ANY, "--file", "-f") {
104 void process(Main jartool, String opt, String arg) {
105 jartool.fname = arg;
106 }
107 },
108 new Option(false, OptionType.ANY, "--verbose", "-v") {
109 void process(Main jartool, String opt, String arg) {
110 jartool.vflag = true;
111 }
112 },
113 new Option(false, OptionType.CREATE, "--normalize", "-n") {
114 void process(Main jartool, String opt, String arg) {
128 },
129 new Option(false, OptionType.CREATE_UPDATE, "--no-manifest", "-M") {
130 void process(Main jartool, String opt, String arg) {
131 jartool.Mflag = true;
132 }
133 },
134 new Option(true, OptionType.CREATE_UPDATE, "--module-version") {
135 void process(Main jartool, String opt, String arg) {
136 jartool.moduleVersion = Version.parse(arg);
137 }
138 },
139 new Option(true, OptionType.CREATE_UPDATE, "--hash-modules") {
140 void process(Main jartool, String opt, String arg) throws BadArgs {
141 try {
142 jartool.modulesToHash = Pattern.compile(arg);
143 } catch (PatternSyntaxException e) {
144 throw new BadArgs("err.badpattern", arg).showUsage(true);
145 }
146 }
147 },
148 new Option(true, OptionType.CREATE_UPDATE, "--module-path", "-p") {
149 void process(Main jartool, String opt, String arg) {
150 String[] dirs = arg.split(File.pathSeparator);
151 Path[] paths = new Path[dirs.length];
152 int i = 0;
153 for (String dir : dirs) {
154 paths[i++] = Paths.get(dir);
155 }
156 jartool.moduleFinder = ModuleFinder.compose(jartool.moduleFinder,
157 ModuleFinder.of(paths));
158 }
159 },
160 new Option(false, OptionType.CREATE_UPDATE_INDEX, "--no-compress", "-0") {
161 void process(Main jartool, String opt, String arg) {
162 jartool.flag0 = true;
163 }
164 },
165
166 // Hidden options
167 new Option(false, OptionType.OTHER, "-P") {
168 void process(Main jartool, String opt, String arg) {
|