Merge pull request #1327 from hapifhir/do-20230627-fix-help-placeholders

Fix CLI '-help' text placeholders
This commit is contained in:
Grahame Grieve 2023-06-28 15:51:29 +10:00 committed by GitHub
commit a0c776e61d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 7 deletions

View File

@ -1,9 +1,6 @@
package org.hl7.fhir.utilities;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
import java.util.*;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.exceptions.FHIRException;
@ -41,6 +38,9 @@ import org.hl7.fhir.exceptions.FHIRException;
public class VersionUtilities {
public static final String[] SUPPORTED_MAJOR_VERSIONS = {"1.0", "1.4", "3.0", "4.0", "5.0", "6.0"};
public static final String[] SUPPORTED_VERSIONS = {"1.0.2", "1.4.0", "3.0.2", "4.0.1", "4.1.0", "4.3.0", "5.0.0", "6.0.0"};
public static class VersionURLInfo {
private String version;
private String url;
@ -138,11 +138,23 @@ public class VersionUtilities {
if (version.contains("-")) {
version = version.substring(0, version.indexOf("-"));
}
return Utilities.existsInList(version, "1.0.2", "1.4.0", "3.0.2", "4.0.1", "4.1.0", "4.3.0", "5.0.0", "6.0.0");
return Utilities.existsInList(version, SUPPORTED_VERSIONS);
}
public static String listSupportedVersions() {
return "1.0.2, 1.4.0, 3.0.2, 4.0.1, 4.1.0, 4.3.0, 5.0, 6.0";
return listVersions(SUPPORTED_VERSIONS);
}
public static String listSupportedMajorVersions() {
return listVersions(SUPPORTED_MAJOR_VERSIONS);
}
private static String listVersions(String[] versions) {
StringJoiner stringJoiner = new StringJoiner(", ");
for (String supportedVersion : versions) {
stringJoiner.add(supportedVersion);
}
return stringJoiner.toString();
}
public static boolean isR6Ver(String ver) {

View File

@ -1,9 +1,11 @@
package org.hl7.fhir.validation.cli.tasks;
import ca.uhn.fhir.context.FhirVersionEnum;
import org.hl7.fhir.r5.model.Constants;
import org.hl7.fhir.r5.model.ImplementationGuide;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.utilities.TimeTracker;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.validation.ValidationEngine;
import org.hl7.fhir.validation.cli.model.CliContext;
import org.hl7.fhir.validation.cli.services.ValidationService;
@ -15,9 +17,13 @@ import java.io.PrintStream;
public class ValidateTask extends ValidationEngineTask {
final static String[][] PLACEHOLDERS = {
{ "XML_AND_JSON_FHIR_VERSIONS", "1.0, 1.4, 3.0, 4.0, " + Constants.VERSION_MM },
{ "XML_AND_JSON_FHIR_VERSIONS", "1.0, 1.4, 3.0, 4.0, " + Constants.VERSION_MM + ", 6.0" },
{ "TURTLE_FHIR_VERSIONS", "3.0, 4.0, " + Constants.VERSION_MM },
{ "FHIR_MAJOR_VERSIONS", VersionUtilities.listSupportedMajorVersions()},
{ "FHIR_MINOR_VERSIONS", VersionUtilities.listSupportedVersions() },
{ "FHIR_CURRENT_VERSION", Constants.VERSION_MM}
};
@Override
public String getName() {
return "validate";