org.bitbucket.bradleysmithllc.etlunit.cli.CliMain Maven / Gradle / Ivy
package org.bitbucket.bradleysmithllc.etlunit.cli;
import cli.Run;
import org.bitbucket.bradleysmithllc.etlunit.io.FileBuilder;
import org.bitbucket.bradleysmithllc.etlunit.util.IOUtils;
import org.bitbucket.bradleysmithllc.etlunit.util.JSonBuilderProxy;
import org.bitbucket.bradleysmithllc.java_cl_parser.CLIEntry;
import org.bitbucket.bradleysmithllc.java_cl_parser.CLIMain;
import org.bitbucket.bradleysmithllc.java_cl_parser.CommonsCLILauncher;
import java.io.File;
@CLIEntry(
version = "2.0.16",
description = "Main entry point for the command line etlunit."
)
public class CliMain {
public static File WORKING_ROOT = new File(".");
public static void main(String [] argv) {
CommonsCLILauncher.mainClean(argv);
}
@CLIMain
public void go(String [] argv) throws Exception {
File root = new FileBuilder(WORKING_ROOT).subdir("target").mkdirs().file();
File lib = new FileBuilder(WORKING_ROOT).subdir("lib").mkdirs().file();
File file = new FileBuilder(root).subdir("cli").mkdirs().name("cli.config").file();
JSonBuilderProxy proxy = new JSonBuilderProxy()
.object()
.key("properties")
.object()
.key("libDir")
.value(lib.getAbsolutePath())
.key("pluginsDir")
.value(lib.getAbsolutePath())
.endObject()
.key("controllers")
.object()
.key("org.clamshellcli.impl.CmdController")
.object()
.key("enabled")
.value("true")
.key("inputPattern")
.value("\\s*(exit|help|sysinfo|" + getCommandsList() + "|last)\\b.*")
.key("expectedInputs")
.array()
.endArray()
.endObject()
.endObject()
.endObject();
IOUtils.writeBufferToFile(file, new StringBuffer(proxy.toString()));
System.setProperty("cli.config.file", file.getAbsolutePath());
Run.main(argv);
}
private static String getCommandsList() {
return
SleepCmd.ACTION_NAME + "|"
+ TimeCmd.ACTION_NAME + "|"
+ ListInstalledFeaturesCmd.ACTION_NAME + "|"
+ ListAvailableFeaturesCmd.ACTION_NAME + "|"
+ DescribeCmd.ACTION_NAME + "|"
+ TestCmd.ACTION_NAME + "|"
+ AddAvailableFeatureCmd.ACTION_NAME + "|"
+ SetCmd.ACTION_NAME + "|"
+ UpdateCmd.ACTION_NAME + "|"
+ MigrateCmd.ACTION_NAME + "|"
+ VersionsCmd.ACTION_NAME + "|"
+ OpenCmd.ACTION_NAME + "|"
+ ProfileCmd.ACTION_NAME + "|"
+ ReportCmd.ACTION_NAME;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy