1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-10 02:39:39 +02:00

Sop: Sync version with gradle version variable and fix format

This commit is contained in:
Paul Schaub 2021-03-05 13:04:28 +01:00
parent bfbb2ba31b
commit 8e3b61b76e
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 34 additions and 3 deletions

View file

@ -15,15 +15,27 @@
*/
package org.pgpainless.sop.commands;
import picocli.CommandLine;
import static org.pgpainless.sop.Print.print_ln;
import java.io.IOException;
import java.util.Properties;
import picocli.CommandLine;
@CommandLine.Command(name = "version", description = "Display version information about the tool")
public class Version implements Runnable {
@Override
public void run() {
print_ln("PGPainless CLI version 0.0.1");
// See https://stackoverflow.com/a/50119235
String version;
try {
Properties properties = new Properties();
properties.load(getClass().getResourceAsStream("/version.properties"));
version = properties.getProperty("version");
} catch (IOException e) {
version = "DEVELOPMENT";
}
print_ln("PGPainlessCLI " + version);
}
}