1 /*
2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
183 throw new BadArgs("error.bad.reason", arg);
184 }
185 }
186 boolean isExtra() { return true; }
187 },
188 new Option(false, OptionType.CREATE_UPDATE_INDEX, "--no-compress", "-0") {
189 void process(Main jartool, String opt, String arg) {
190 jartool.flag0 = true;
191 }
192 },
193
194 // Hidden options
195 new Option(false, OptionType.OTHER, "-P") {
196 void process(Main jartool, String opt, String arg) {
197 jartool.pflag = true;
198 }
199 boolean isHidden() { return true; }
200 },
201
202 // Other options
203 new Option(true, true, OptionType.OTHER, "--help", "-h") {
204 void process(Main jartool, String opt, String arg) throws BadArgs {
205 if (jartool.info == null) {
206 if (arg == null) {
207 jartool.info = GNUStyleOptions::printHelp; // Main.Info.HELP;
208 return;
209 }
210 if (!arg.equals("compat"))
211 throw new BadArgs("error.illegal.option", arg).showUsage(true);
212 // jartool.info = Main.Info.COMPAT_HELP;
213 jartool.info = GNUStyleOptions::printCompatHelp;
214 }
215 }
216 },
217 new Option(false, OptionType.OTHER, "--help-extra") {
218 void process(Main jartool, String opt, String arg) throws BadArgs {
219 jartool.info = GNUStyleOptions::printHelpExtra;
220 }
221 },
222 new Option(false, OptionType.OTHER, "--version") {
223 void process(Main jartool, String opt, String arg) {
|
1 /*
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
183 throw new BadArgs("error.bad.reason", arg);
184 }
185 }
186 boolean isExtra() { return true; }
187 },
188 new Option(false, OptionType.CREATE_UPDATE_INDEX, "--no-compress", "-0") {
189 void process(Main jartool, String opt, String arg) {
190 jartool.flag0 = true;
191 }
192 },
193
194 // Hidden options
195 new Option(false, OptionType.OTHER, "-P") {
196 void process(Main jartool, String opt, String arg) {
197 jartool.pflag = true;
198 }
199 boolean isHidden() { return true; }
200 },
201
202 // Other options
203 new Option(true, true, OptionType.OTHER, "--help", "-h", "-?") {
204 void process(Main jartool, String opt, String arg) throws BadArgs {
205 if (jartool.info == null) {
206 if (arg == null) {
207 jartool.info = GNUStyleOptions::printHelp; // Main.Info.HELP;
208 return;
209 }
210 if (!arg.equals("compat"))
211 throw new BadArgs("error.illegal.option", arg).showUsage(true);
212 // jartool.info = Main.Info.COMPAT_HELP;
213 jartool.info = GNUStyleOptions::printCompatHelp;
214 }
215 }
216 },
217 new Option(false, OptionType.OTHER, "--help-extra") {
218 void process(Main jartool, String opt, String arg) throws BadArgs {
219 jartool.info = GNUStyleOptions::printHelpExtra;
220 }
221 },
222 new Option(false, OptionType.OTHER, "--version") {
223 void process(Main jartool, String opt, String arg) {
|