src/main/java/de/vandermeer/execs/Gen_RunScripts.java
protected final int initTargetAndStg(){
		this.target = this.optionTarget.getValue();
		if(this.target==null){
			System.err.println(this.getAppName() + ": no target set");
			return -1;
		}

		String fileName = this.optionStgFile.getValue();
		try{
			this.stg = new STGroupFile(fileName);
		}
		catch(Exception e){
			System.err.println(this.getAppName() + ": cannot load stg file <" + fileName + ">, general exception\n--> " + e);
			return -1;
		}
		String[] availableTargets = null;
		try{
			availableTargets = StringUtils.split(this.stg.getInstanceOf("supportedTargets").render(), " , ");
		}
		catch(Exception e){
			System.err.println(this.getAppName() + ": stg file <" + fileName + "> does not contain <supportedTargets> function");
			return -1;
		}
		if(availableTargets.length==0){
			System.err.println(this.getAppName() + ": stg file <" + fileName + "> does not have a list of targets in <supportedTargets> function");
			return -1;
		}
		if(!ArrayUtils.contains(availableTargets, this.target)){
			System.err.println(this.getAppName() + ": target " + this.target + " not supported in stg file <" + fileName + ">");
			return -1;
		}

		System.out.println(this.getAppName() + ": generating scripts for target: " + this.target);
		System.out.println();
		return 0;
	}
protected final int initTargetAndStg(){
		this.target = this.optionTarget.getValue();
		if(this.target==null){
			System.err.println(this.getAppName() + ": no target set");
			return -1;
		}

		String fileName = this.optionStgFile.getValue();
		try{
			this.stg = new STGroupFile(fileName);
		}
		catch(Exception e){
			System.err.println(this.getAppName() + ": cannot load stg file <" + fileName + ">, general exception\n--> " + e);
			return -1;
		}
		String[] availableTargets = null;
		try{
			availableTargets = StringUtils.split(this.stg.getInstanceOf("supportedTargets").render(), " , ");
		}
		catch(Exception e){
			System.err.println(this.getAppName() + ": stg file <" + fileName + "> does not contain <supportedTargets> function");
			return -1;
		}
		if(availableTargets.length==0){
			System.err.println(this.getAppName() + ": stg file <" + fileName + "> does not have a list of targets in <supportedTargets> function");
			return -1;
		}
		if(!ArrayUtils.contains(availableTargets, this.target)){
			System.err.println(this.getAppName() + ": target " + this.target + " not supported in stg file <" + fileName + ">");
			return -1;
		}

		System.out.println(this.getAppName() + ": generating scripts for target: " + this.target);
		System.out.println();
		return 0;
	}
Sets target for generation and initializes an STG object from an stg template file.
The default template file name is "de/vandermeer/execs/executable-script.stg".
This default can be overwritten using the property "stg.file" in the configuration properties file.
The default and the property file name can be overwritten using the "--stg-file" CLI option.
The set target (CLI option "--target") must be supported by the template file, otherwise this method will fail.
@return 0 on success with configuration loaded, -1 on error with errors printed on standard error