package bach.info;

import com.github.sormuras.bach.Bach;
import com.github.sormuras.bach.tool.ExecutableJar;
import java.nio.file.Path;
import java.util.List;

public record PomChecker(Path jar, List<Argument> arguments) implements ExecutableJar<PomChecker> {

  public static PomChecker install(Bach bach) {
    var version = "1.1.0-SNAPSHOT";
    var file = "pomchecker-toolprovider-" + version + ".jar";
    var uri = "https://github.com/kordamp/pomchecker/releases/download/early-access/" + file;
    var jar = ExecutableJar.load(bach, "kordamp-pomchecker", version, uri);
    return new PomChecker(jar, List.of());
  }

  @Override
  public PomChecker arguments(List<Argument> arguments) {
    return new PomChecker(jar, arguments);
  }

  @Override
  public String name() {
    return "pomchecker";
  }

  public PomChecker checkMavenCentral(Path pom) {
    return add("check-maven-central").add("--file", pom);
  }
}

@@ -152,16 +152,47 @@
 il.List;
+%0Aimport java.util.StringJoiner;
 %0A%0Apublic
@@ -342,194 +342,398 @@
     
-var version = %221.1.0-SNAPSHOT%22;%0A    var file = %22pomc
+return install(bach, %221.1.0%22);%0A  %7D%0A%0A  public static PomC
 hecker
--toolprovider-%22 + version + %22.jar%22;%0A    var uri = %22https://github.com/kordamp/pomchecker/releases/download/early-access/%22 + file
+ install(Bach bach, String version) %7B%0A    var uri =%0A        new StringJoiner(%22/%22)%0A            .add(%22https://repo.maven.apache.org/maven2%22)%0A            .add(%22org.kordamp.maven%22.replace('.', '/'))%0A            .add(%22pomchecker-toolprovider%22)%0A            .add(version)%0A            .add(%22pomchecker-toolprovider-%22 + version + %22.jar%22)
 ;%0A  
@@ -803,16 +803,27 @@
 ion, uri
+.toString()
 );%0A    r

Upgrade PomChecker to 1.1.0