Commit c316a2af authored by Daniel Honsel's avatar Daniel Honsel
Browse files

added old options helper stuff

parent 63ab5b5f
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
package de.ugoe.cs.swe.common;

import org.apache.commons.cli.Option;

public class OptionWithID extends Option {

	private static final long serialVersionUID = -2643329397818768355L;
	private int id;

	public OptionWithID(String opt, String longOpt, boolean hasArg, String description) throws IllegalArgumentException {
		super(opt, longOpt, hasArg, description);
	}

	public OptionWithID(String longOpt, boolean hasArg, String description) throws IllegalArgumentException {
		super(null, longOpt, hasArg, description);
	}

	public OptionWithID(int id, String longOpt, boolean hasArg, String description) throws IllegalArgumentException {
		super(null, longOpt, hasArg, description);
		this.setId(id);
	}

	public OptionWithID(int id, String longOpt, String description) throws IllegalArgumentException {
		super(null, description);
		this.setLongOpt(longOpt);
		this.setId(id);
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getId() {
		return this.id;
	}
}
+57 −0
Original line number Diff line number Diff line
package de.ugoe.cs.swe.common;

import org.apache.commons.cli.Options;

public class OptionsHandler {

	private Options options = new Options();

	public OptionsHandler() {
		this.initialize();
	}

	private void initialize() {

		OptionWithID optionWithID;

		optionWithID = new OptionWithID(9, "generate-config", "Generate a new default configuration file at the specified file location");
		optionWithID.setArgs(1);
		optionWithID.setArgName("FILE NAME");
		getOptions().addOption(optionWithID);

		optionWithID = new OptionWithID(10, "config", "Configuration file location\n");
		optionWithID.setArgs(1);
		optionWithID.setArgName("FILE NAME");
		// optionWithID.setRequired(true);
		getOptions().addOption(optionWithID);

		optionWithID = new OptionWithID(20, "profile", "Configuration profile\n");
		optionWithID.setArgs(1);
		optionWithID.setArgName("PROFILE NAME");
		getOptions().addOption(optionWithID);

		optionWithID = new OptionWithID(30, "verbosity", "Verbosity level (currently supports ERROR, WARNING and INFORMATION values)\n");
		optionWithID.setArgs(1);
		optionWithID.setArgName("LOG LEVEL");
		getOptions().addOption(optionWithID);

		optionWithID = new OptionWithID(40, "output-path",
				"Destination path for the output (if applicable, otherwise ignored). Overrides the profile setting.\n");
		optionWithID.setArgs(1);
		optionWithID.setArgName("PATH");
		getOptions().addOption(optionWithID);

		optionWithID = new OptionWithID(100, "help", "Show this usage information screen\n");
		getOptions().addOption(optionWithID);

	}

	public void setOptions(Options options) {
		this.options = options;
	}

	public Options getOptions() {
		return options;
	}

}
 No newline at end of file
+15 −0
Original line number Diff line number Diff line
package de.ugoe.cs.swe.common;

public class T3QOptionsHandler extends OptionsHandler {

	public T3QOptionsHandler() {
		super();
		//this.initializeCustomOptions();
	}

	private void initializeCustomOptions() {
		OptionWithID optionWithID;
		optionWithID = new OptionWithID(21, "format", "Apply code formatting\n");
		getOptions().addOption(optionWithID);
	}
}