package com.github.aureliano.achmed;

import java.util.Properties;

import com.github.aureliano.achmed.helper.FileHelper;
import com.github.aureliano.achmed.helper.PropertyHelper;

public class Application {

	public Application() {
		super();
	}
	
	public static void main(String[] args) {
		new Application().startUp(args);
	}
	
	public void startUp(String[] args) {
		if (args.length == 0) {
			this.printHelp();
			return;
		}
		
		if ((args[0].equals("-h")) || (args[0].equals("--help")) || (args[0].equals("help"))) {
			this.printHelp();
		} else if ((args[0].equals("-v")) || (args[0].equals("--version")) || (args[0].equals("version"))) {
			this.printVersion();
		} else if (args[0].equals("burst")) {
			this.prepareExecution(args[1]);
		} else {
			this.printError(args);
		}
	}

	protected void prepareExecution(String string) {
		throw new UnsupportedOperationException("Not implemented yet");
	}

	protected void printHelp() {
		String help = FileHelper.readResource("meta/help");
		System.out.println(help);
	}
	
	protected void printVersion() {
		Properties properties = PropertyHelper.loadProperties("meta/version.properties");
		StringBuilder builder = new StringBuilder("achmed")
			.append(" ")
			.append(properties.get("version"))
			.append(":")
			.append(properties.get("release"))
			.append(" (")
			.append(properties.get("date"))
			.append(")");
		
		System.out.println(builder);
	}
	
	private void printError(String[] args) {
		throw new UnsupportedOperationException("Not implemented yet");
	}
}
@@ -61,16 +61,77 @@
 rties;%0A%0A
+import com.github.aureliano.achmed.helper.ApplicationHelper;%0A
 import c
@@ -1003,62 +1003,8 @@
 %0A%09%09S
-tring help = FileHelper.readResource(%22meta/help%22);%0A%09%09S
 yste
@@ -1017,20 +1017,40 @@
 println(
+ApplicationHelper.
 help
+()
 );%0A%09%7D%0A%09%0A
@@ -1088,352 +1088,54 @@
 %7B%0A%09%09
-Properties properties = PropertyHelper.loadProperties(%22meta/version.properties%22);%0A%09%09StringBuilder builder = new StringBuilder(%22achmed%22)%0A%09%09%09.append(%22 %22)%0A%09%09%09.append(properties.get(%22version%22))%0A%09%09%09.append(%22:%22)%0A%09%09%09.append(properties.get(%22release%22))%0A%09%09%09.append(%22 (%22)%0A%09%09%09.append(properties.get(%22date%22))%0A%09%09%09.append(%22)%22);%0A%09%09%0A%09%09System.out.println(builder
+System.out.println(ApplicationHelper.version()
 );%0A%09

Use application helper to build help and version messages.