mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-03-01 17:09:08 +00:00
Fix literal inclusion of Java contants in static text file in cli hjelp
This commit is contained in:
parent
f368b021e3
commit
b9fe85996b
@ -134,7 +134,7 @@ public class VersionUtilities {
|
||||
}
|
||||
|
||||
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, "+CURRENT_FULL_VERSION;
|
||||
return "1.0.2, 1.4.0, 3.0.2, 4.0.1, 4.1.0, 4.3.0, 5.0, " + CURRENT_FULL_VERSION;
|
||||
}
|
||||
|
||||
public static boolean isR5Ver(String ver) {
|
||||
|
@ -2,12 +2,16 @@ package org.hl7.fhir.validation.cli.utils;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.hl7.fhir.r5.model.Constants;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||
import org.hl7.fhir.utilities.npm.ToolsVersion;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Class for displaying output to the cli user.
|
||||
@ -16,6 +20,7 @@ import java.io.InputStream;
|
||||
*/
|
||||
public class Display {
|
||||
|
||||
|
||||
private static String toMB(long maxMemory) {
|
||||
return Long.toString(maxMemory / (1024 * 1024));
|
||||
}
|
||||
@ -29,6 +34,25 @@ public class Display {
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
final static String CURLY_START = "\\{\\{";
|
||||
final static String CURLY_END = "\\}\\}";
|
||||
|
||||
final static String[][] PLACEHOLDERS = {
|
||||
{ CURLY_START + "XML_AND_JSON_FHIR_VERSIONS" + CURLY_END, "1.0, 1.4, 3.0, 4.0," + Constants.VERSION_MM },
|
||||
{ CURLY_START + "TURTLE_FHIR_VERSIONS" + CURLY_END, "3.0, 4.0, " + Constants.VERSION_MM },
|
||||
{ CURLY_START + "FHIR_MAJOR_VERSIONS" + CURLY_END, "1.0|1.4|3.0|" + VersionUtilities.CURRENT_VERSION},
|
||||
{ CURLY_START + "FHIR_MINOR_VERSIONS" + CURLY_END, "1.0.2|1.4.0|3.0.2|4.0.1|" + VersionUtilities.CURRENT_FULL_VERSION },
|
||||
{ CURLY_START + "FHIR_CURRENT_VERSION" + CURLY_END, VersionUtilities.CURRENT_VERSION},
|
||||
};
|
||||
|
||||
final static String replacePlaceholders(String input, String[][] placeholders) {
|
||||
String output = input;
|
||||
for (String[] placeholder : placeholders) {
|
||||
output = output.replaceAll(placeholder[0], placeholder[1]);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the help details from resources/help.txt, and displays them on the command line to the user.
|
||||
*/
|
||||
@ -37,12 +61,15 @@ public class Display {
|
||||
InputStream help = classLoader.getResourceAsStream("help.txt");
|
||||
try {
|
||||
String data = IOUtils.toString(help, "UTF-8");
|
||||
System.out.println(data);
|
||||
|
||||
System.out.println(replacePlaceholders(data, PLACEHOLDERS));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prints out system info to the command line.
|
||||
*/
|
||||
|
@ -6,8 +6,8 @@ command line
|
||||
|
||||
The FHIR validation tool validates a FHIR resource or bundle.
|
||||
Schema and schematron checking is performed, then some additional checks are performed.
|
||||
* XML & Json (FHIR versions 1.0, 1.4, 3.0, 4.0, " + Constants.VERSION_MM + ")
|
||||
* Turtle (FHIR versions 3.0, 4.0, " + Constants.VERSION_MM + ")
|
||||
* XML & Json (FHIR versions {{XML_AND_JSON_FHIR_VERSIONS}})
|
||||
* Turtle (FHIR versions {{TURTLE_FHIR_VERSIONS}})
|
||||
|
||||
If requested, instances will also be verified against the appropriate schema
|
||||
W3C XML Schema, JSON schema or ShEx, as appropriate
|
||||
@ -22,8 +22,8 @@ The following parameters are supported:
|
||||
Patterns are limited to a directory followed by a filename with an embedded
|
||||
asterisk. E.g. foo*-examples.xml or someresource.*, etc.
|
||||
-version [ver]: The FHIR version to use. This can only appear once.
|
||||
valid values 1.0 | 1.4 | 3.0 | " + VersionUtilities.CURRENT_VERSION + " or 1.0.2 | 1.4.0 | 3.0.2 | 4.0.1 | " + VersionUtilities.CURRENT_FULL_VERSION);
|
||||
Default value is " + VersionUtilities.CURRENT_VERSION);
|
||||
valid values {{FHIR_MAJOR_VERSIONS}} or {{FHIR_MINOR_VERSIONS}}
|
||||
Default value is {{FHIR_CURRENT_VERSION}}
|
||||
-ig [package|file|folder|url]: an IG or profile definition to load. Can be
|
||||
the URL of an implementation guide or a package ([id]-[ver]) for
|
||||
a built implementation guide or a local folder that contains a
|
||||
@ -48,7 +48,7 @@ The following parameters are supported:
|
||||
-showReferenceMessages
|
||||
Includes validation messages resulting from validating target resources
|
||||
against profiles defined on a reference. This increases the volume of
|
||||
validationmessages, but may allow easier debugging. If not specified,
|
||||
validation messages, but may allow easier debugging. If not specified,
|
||||
then only a high-level message indicating that the referenced item wasn't
|
||||
valid against the listed profile(s) will be provided.
|
||||
-questionnaire mode: what to do with when validating QuestionnaireResponse resources
|
||||
|
Loading…
x
Reference in New Issue
Block a user