org.nasdanika.launcher.Launcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cli-launcher Show documentation
Show all versions of cli-launcher Show documentation
Launcher of Nasdanika Command Line Interface. Builds a distribution.
package org.nasdanika.launcher;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.nasdanika.capability.CapabilityLoader;
import org.nasdanika.capability.CapabilityProvider;
import org.nasdanika.capability.ServiceCapabilityFactory;
import org.nasdanika.capability.ServiceCapabilityFactory.Requirement;
import org.nasdanika.cli.ShellCommand;
import org.nasdanika.cli.SubCommandRequirement;
import org.nasdanika.common.Closeable;
import org.nasdanika.common.NullProgressMonitor;
import org.nasdanika.common.ProgressMonitor;
import picocli.CommandLine;
public class Launcher {
public static void main(String[] args) {
CapabilityLoader capabilityLoader = new CapabilityLoader(Launcher.class.getModule().getLayer());
// ProgressMonitor progressMonitor = new PrintStreamProgressMonitor(true);
ProgressMonitor progressMonitor = new NullProgressMonitor(); // TODO configurable through system properties
// Sub-commands, sorting alphabetically
List rootCommands = new ArrayList<>();
Requirement subCommandRequirement = ServiceCapabilityFactory.createRequirement(CommandLine.class, null, new SubCommandRequirement(Collections.emptyList()));
for (CapabilityProvider