Skip to content

Commit

Permalink
Make docs URL in usage help version-specific
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed May 16, 2024
1 parent e07cbb6 commit 4c44952
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public CommandFacade(ConsoleTestExecutor.Factory consoleTestExecutorFactory) {
}

public CommandResult<?> run(PrintWriter out, PrintWriter err, String[] args) {
String version = ManifestVersionProvider.getImplementationVersion();
System.setProperty("junit.docs.version",
version == null ? "current" : (version.endsWith("-SNAPSHOT") ? "snapshot" : version));
return new MainCommand(consoleTestExecutorFactory).run(out, err, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
description = "Launches the JUnit Platform for test discovery and execution.", //
footerHeading = "%n", //
footer = "For more information, please refer to the JUnit User Guide at%n" //
+ "@|underline https://junit.org/junit5/docs/current/user-guide/|@", //
+ "@|underline https://junit.org/junit5/docs/${junit.docs.version}/user-guide/|@", //
scope = CommandLine.ScopeType.INHERIT, //
exitCodeOnInvalidInput = CommandResult.FAILURE, //
exitCodeOnExecutionException = CommandResult.FAILURE, //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@

class ManifestVersionProvider implements CommandLine.IVersionProvider {

public static String getImplementationVersion() {
return ManifestVersionProvider.class.getPackage().getImplementationVersion();
}

@Override
public String[] getVersion() {
String version = getClass().getPackage().getImplementationVersion();
return new String[] { //
"@|bold JUnit Platform Console Launcher " + version + "|@", //
String.format("@|bold JUnit Platform Console Launcher %s|@", getImplementationVersion()), //
"JVM: ${java.version} (${java.vendor} ${java.vm.name} ${java.vm.version})", //
"OS: ${os.name} ${os.version} ${os.arch}" //
};
Expand Down

0 comments on commit 4c44952

Please sign in to comment.