Skip to content

Commit

Permalink
Command line switch "-version"
Browse files Browse the repository at this point in the history
  • Loading branch information
victor committed Dec 12, 2016
1 parent 8a62e01 commit c2eddbd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
plugins {
id 'java'
id 'eclipse'
}

version = '0.9.1'

jar {
manifest {
attributes 'Implementation-Version': version
}
}
15 changes: 13 additions & 2 deletions src/main/java/kz/pvnhome/pvnt/PVNTemplateRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
* @author victor
*/
public class PVNTemplateRunner {
public static void main(String[] args) {
System.out.println("PVN Template engine (version 0.91 beta)");
public static final String VERSION = "0.91 beta";

public static void main(String[] args) {
String path = ".";
String ext = "html";
boolean debugMode = false;
Expand All @@ -40,6 +40,9 @@ public static void main(String[] args) {
if ("-h".equals(args[0]) || "-help".equals(args[0])) {
printUsage();
System.exit(0);
} else if ("-version".equals(args[0])) {
printVersion();
System.exit(0);
} else if ("-d".equals(args[0]) || "-debug".equals(args[0])) {
debugMode = true;
ind++;
Expand All @@ -58,6 +61,8 @@ public static void main(String[] args) {
System.exit(0);
}

printVersion();

System.out.println("INFO: Process all " + ext + " files in " + path + " (debug " + (debugMode ? "on" : "off") + ")");

try {
Expand Down Expand Up @@ -91,9 +96,15 @@ public static void main(String[] args) {
}

private static void printUsage() {
printVersion();
System.out.println("usage: pvnt [options] [path/to/site [extension]]");
System.out.println("Options:");
System.out.println(" -help, -h print this message");
System.out.println(" -version print the version information and exit");
System.out.println(" -debug, -d print debugging information");
}

private static void printVersion() {
System.out.println("PVN Template engine (version " + VERSION + ")");
}
}

0 comments on commit c2eddbd

Please sign in to comment.