Exemple #1
0
 @CreatorParam("java")
 public void create(String[] params) {
   if (params.length == 0) throw JCreate.error("Requires a project name.");
   String projectName = params[0];
   if (!useable(projectName)) throw JCreate.error("Invalid project name.");
   System.out.println("Creating Java Project ['" + projectName + "']");
   File project = new File(JCreate.CWD(), projectName);
   if (project.exists()) {
     if (!overwrite) {
       System.out.println(
           "Project already exists with that name, if you wish to overwrite it use the flags: [-o or -overwrite]");
       System.out.println("Exiting...");
       return;
     }
     System.out.println("Attempting to delete project: " + projectName);
     if (!Files.delete(project))
       throw JCreate.error("Failed to delete previous project. Aborting...");
     System.out.println("Resuming...");
   }
   if (github) {
     System.out.println("Currently not a thing.");
   }
   Files.openZip(
       TEMPLATE_ZIP,
       project,
       ((name, entry, file) -> processFile(projectName, name, entry, file)));
 }
Exemple #2
0
 @CreatorError
 public void error(String[] params) {
   if (params.length == 0) throw JCreate.error("No creator specified. Available options: [TODO]");
   throw JCreate.error("Failed to locate creator with '" + params[0] + '\'');
 }