< prev index next >

jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java

Print this page




1164             builder.append(getMessage("main.opt.mode.hash")).append("\n\n");
1165 
1166             String cmdfile = null;
1167             String[] lines = content.split("\n");
1168             for (String line : lines) {
1169                 if (line.startsWith("--@")) {
1170                     cmdfile = line.replace("--" + CMD_FILENAME, CMD_FILENAME + "  ");
1171                 } else if (line.startsWith("Option") || line.startsWith("------")) {
1172                     builder.append(" ").append(line).append("\n");
1173                 } else if (!line.matches("Non-option arguments")){
1174                     builder.append("  ").append(line).append("\n");
1175                 }
1176             }
1177             if (cmdfile != null) {
1178                 builder.append("  ").append(cmdfile).append("\n");
1179             }
1180             return builder.toString();
1181         }
1182     }
1183 
1184     private final OptionParser parser = new OptionParser();
1185 
1186     private void handleOptions(String[] args) {
1187         parser.formatHelpWith(new JmodHelpFormatter());
1188 
1189         OptionSpec<Path> classPath
1190                 = parser.accepts("class-path", getMessage("main.opt.class-path"))
1191                         .withRequiredArg()
1192                         .withValuesSeparatedBy(File.pathSeparatorChar)
1193                         .withValuesConvertedBy(ClassPathConverter.INSTANCE);
1194 
1195         OptionSpec<Path> cmds
1196                 = parser.accepts("cmds", getMessage("main.opt.cmds"))
1197                         .withRequiredArg()
1198                         .withValuesSeparatedBy(File.pathSeparatorChar)
1199                         .withValuesConvertedBy(DirPathConverter.INSTANCE);
1200 
1201         OptionSpec<Path> config
1202                 = parser.accepts("config", getMessage("main.opt.config"))
1203                         .withRequiredArg()
1204                         .withValuesSeparatedBy(File.pathSeparatorChar)
1205                         .withValuesConvertedBy(DirPathConverter.INSTANCE);
1206 
1207         OptionSpec<Void> dryrun
1208             = parser.accepts("dry-run", getMessage("main.opt.dry-run"));
1209 
1210         OptionSpec<PathMatcher> excludes
1211                 = parser.accepts("exclude", getMessage("main.opt.exclude"))
1212                         .withRequiredArg()
1213                         .withValuesConvertedBy(new PathMatcherConverter());
1214 
1215         OptionSpec<Pattern> hashModules
1216                 = parser.accepts("hash-modules", getMessage("main.opt.hash-modules"))
1217                         .withRequiredArg()
1218                         .withValuesConvertedBy(new PatternConverter());
1219 
1220         OptionSpec<Void> help
1221                 = parser.accepts("help", getMessage("main.opt.help"))
1222                         .forHelp();
1223 
1224         OptionSpec<Path> libs
1225                 = parser.accepts("libs", getMessage("main.opt.libs"))
1226                         .withRequiredArg()
1227                         .withValuesSeparatedBy(File.pathSeparatorChar)
1228                         .withValuesConvertedBy(DirPathConverter.INSTANCE);
1229 
1230         OptionSpec<String> mainClass
1231                 = parser.accepts("main-class", getMessage("main.opt.main-class"))
1232                         .withRequiredArg()
1233                         .describedAs(getMessage("main.opt.main-class.arg"));
1234 
1235         OptionSpec<Path> modulePath  // TODO: short version of --mp ??
1236                 = parser.acceptsAll(Arrays.asList("mp", "modulepath"),
1237                                     getMessage("main.opt.modulepath"))
1238                         .withRequiredArg()
1239                         .withValuesSeparatedBy(File.pathSeparatorChar)
1240                         .withValuesConvertedBy(DirPathConverter.INSTANCE);
1241 
1242         OptionSpec<Version> moduleVersion
1243                 = parser.accepts("module-version", getMessage("main.opt.module-version"))
1244                         .withRequiredArg()
1245                         .withValuesConvertedBy(new ModuleVersionConverter());
1246 
1247         OptionSpec<String> osName
1248                 = parser.accepts("os-name", getMessage("main.opt.os-name"))
1249                         .withRequiredArg()
1250                         .describedAs(getMessage("main.opt.os-name.arg"));
1251 
1252         OptionSpec<String> osArch
1253                 = parser.accepts("os-arch", getMessage("main.opt.os-arch"))
1254                         .withRequiredArg()
1255                         .describedAs(getMessage("main.opt.os-arch.arg"));
1256 
1257         OptionSpec<String> osVersion




1164             builder.append(getMessage("main.opt.mode.hash")).append("\n\n");
1165 
1166             String cmdfile = null;
1167             String[] lines = content.split("\n");
1168             for (String line : lines) {
1169                 if (line.startsWith("--@")) {
1170                     cmdfile = line.replace("--" + CMD_FILENAME, CMD_FILENAME + "  ");
1171                 } else if (line.startsWith("Option") || line.startsWith("------")) {
1172                     builder.append(" ").append(line).append("\n");
1173                 } else if (!line.matches("Non-option arguments")){
1174                     builder.append("  ").append(line).append("\n");
1175                 }
1176             }
1177             if (cmdfile != null) {
1178                 builder.append("  ").append(cmdfile).append("\n");
1179             }
1180             return builder.toString();
1181         }
1182     }
1183 
1184     private final OptionParser parser = new OptionParser("hp");
1185 
1186     private void handleOptions(String[] args) {
1187         parser.formatHelpWith(new JmodHelpFormatter());
1188 
1189         OptionSpec<Path> classPath
1190                 = parser.accepts("class-path", getMessage("main.opt.class-path"))
1191                         .withRequiredArg()
1192                         .withValuesSeparatedBy(File.pathSeparatorChar)
1193                         .withValuesConvertedBy(ClassPathConverter.INSTANCE);
1194 
1195         OptionSpec<Path> cmds
1196                 = parser.accepts("cmds", getMessage("main.opt.cmds"))
1197                         .withRequiredArg()
1198                         .withValuesSeparatedBy(File.pathSeparatorChar)
1199                         .withValuesConvertedBy(DirPathConverter.INSTANCE);
1200 
1201         OptionSpec<Path> config
1202                 = parser.accepts("config", getMessage("main.opt.config"))
1203                         .withRequiredArg()
1204                         .withValuesSeparatedBy(File.pathSeparatorChar)
1205                         .withValuesConvertedBy(DirPathConverter.INSTANCE);
1206 
1207         OptionSpec<Void> dryrun
1208             = parser.accepts("dry-run", getMessage("main.opt.dry-run"));
1209 
1210         OptionSpec<PathMatcher> excludes
1211                 = parser.accepts("exclude", getMessage("main.opt.exclude"))
1212                         .withRequiredArg()
1213                         .withValuesConvertedBy(new PathMatcherConverter());
1214 
1215         OptionSpec<Pattern> hashModules
1216                 = parser.accepts("hash-modules", getMessage("main.opt.hash-modules"))
1217                         .withRequiredArg()
1218                         .withValuesConvertedBy(new PatternConverter());
1219 
1220         OptionSpec<Void> help
1221                 = parser.acceptsAll(Set.of("h", "help"), getMessage("main.opt.help"))
1222                         .forHelp();
1223 
1224         OptionSpec<Path> libs
1225                 = parser.accepts("libs", getMessage("main.opt.libs"))
1226                         .withRequiredArg()
1227                         .withValuesSeparatedBy(File.pathSeparatorChar)
1228                         .withValuesConvertedBy(DirPathConverter.INSTANCE);
1229 
1230         OptionSpec<String> mainClass
1231                 = parser.accepts("main-class", getMessage("main.opt.main-class"))
1232                         .withRequiredArg()
1233                         .describedAs(getMessage("main.opt.main-class.arg"));
1234 
1235         OptionSpec<Path> modulePath
1236                 = parser.acceptsAll(Set.of("p", "module-path"),
1237                                     getMessage("main.opt.module-path"))
1238                         .withRequiredArg()
1239                         .withValuesSeparatedBy(File.pathSeparatorChar)
1240                         .withValuesConvertedBy(DirPathConverter.INSTANCE);
1241 
1242         OptionSpec<Version> moduleVersion
1243                 = parser.accepts("module-version", getMessage("main.opt.module-version"))
1244                         .withRequiredArg()
1245                         .withValuesConvertedBy(new ModuleVersionConverter());
1246 
1247         OptionSpec<String> osName
1248                 = parser.accepts("os-name", getMessage("main.opt.os-name"))
1249                         .withRequiredArg()
1250                         .describedAs(getMessage("main.opt.os-name.arg"));
1251 
1252         OptionSpec<String> osArch
1253                 = parser.accepts("os-arch", getMessage("main.opt.os-arch"))
1254                         .withRequiredArg()
1255                         .describedAs(getMessage("main.opt.os-arch.arg"));
1256 
1257         OptionSpec<String> osVersion


< prev index next >