Skip to content

Commit

Permalink
refactor(cli): Use printf instead of println in version banner
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Feb 16, 2023
1 parent 93d18cd commit b306d82
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
public class Versions implements CommandLine.IVersionProvider {
private static final ResourceBundle bundle = ResourceBundle.getBundle(Versions.class.getName());
private static final String POMCHECKER_VERSION = bundle.getString("pomchecker_version");
private static final String SEPARATOR = "------------------------------------------------------------%n";

@Override
public String[] getVersion() throws Exception {
Expand All @@ -51,18 +52,18 @@ public static void banner(PrintStream out) {
String buildRevision = manifest.getMainAttributes().getValue("Build-Revision");
boolean additionalInfo = isNotBlank(buildTimestamp) || isNotBlank(buildRevision);

out.println("------------------------------------------------------------");
out.println("PomChecker " + version);
out.println("------------------------------------------------------------");
out.printf(SEPARATOR);
out.printf("PomChecker %s%n", version);
out.printf(SEPARATOR);
if (additionalInfo) {
if (isNotBlank(buildTimestamp)) {
out.println("Build timestamp: " + buildTimestamp);
out.printf("Build timestamp: %s%n", buildTimestamp);
}
if (isNotBlank(buildRevision)) out.println("Revision: " + buildRevision);
out.println("------------------------------------------------------------");
if (isNotBlank(buildRevision)) out.printf("Revision: %s%n", buildRevision);
out.printf(SEPARATOR);
}
} else {
out.println(POMCHECKER_VERSION);
out.printf("%s%n", POMCHECKER_VERSION);
}
}

Expand Down

0 comments on commit b306d82

Please sign in to comment.