All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jwat.tools.HelpTaskCLIParser Maven / Gradle / Ivy

Go to download

JWAT-Tools uses the available JWAT libraries to make high level tasks available either from command-line or programmatically. Common tasks include: Test, Compress, Decompress, CDX, Arc2Warc. More specialised tasks include: Changed, ContainerMD, Delete, Extract, Interval, PathIndex, Unpack, Headers2CDX.

There is a newer version: 0.7.1
Show newest version
package org.jwat.tools;

import com.antiaction.common.cli.Argument;
import com.antiaction.common.cli.ArgumentParserException;
import com.antiaction.common.cli.ArgumentParser;
import com.antiaction.common.cli.CommandLine;
import com.antiaction.common.cli.Options;

public class HelpTaskCLIParser {

	public static final int A_HELPFOR_COMMAND = 101;

	protected HelpTaskCLIParser() {
	}

	public static HelpOptions parseArguments(CommandLine cmdLine) {
		Options cliOptions = new Options();
		try {
			cliOptions.addNamedArgument( "helpfor_command", A_HELPFOR_COMMAND, 1, 1);
			cmdLine = ArgumentParser.parse(cmdLine.argsArray, cliOptions, cmdLine);
		}
		catch (ArgumentParserException e) {
			System.out.println( HelpTaskCLIParser.class.getName() + ": " + e.getMessage() );
			System.exit( 1 );
		}

		HelpOptions options = new HelpOptions();
		Argument argument = cmdLine.idMap.get(A_HELPFOR_COMMAND);
		if (argument != null) {
			options.command = argument.value;
		}
		return options;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy