io.quarkus.cli.Create Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-cli Show documentation
Show all versions of quarkus-cli Show documentation
Quarkus command line utility
package io.quarkus.cli;
import java.util.List;
import java.util.concurrent.Callable;
import io.quarkus.cli.common.HelpOption;
import io.quarkus.cli.common.OutputOptionMixin;
import picocli.CommandLine;
import picocli.CommandLine.ParseResult;
import picocli.CommandLine.Unmatched;
@CommandLine.Command(name = "create", header = "Create a new project.", subcommands = {
CreateApp.class,
CreateCli.class,
CreateExtension.class })
public class Create implements Callable {
@CommandLine.Mixin(name = "output")
protected OutputOptionMixin output;
@CommandLine.Mixin
protected HelpOption helpOption;
@CommandLine.Spec
protected CommandLine.Model.CommandSpec spec;
@Unmatched // avoids throwing errors for unmatched arguments
List unmatchedArgs;
public Integer call() throws Exception {
output.info("Creating an app (default project type, see --help).");
ParseResult result = spec.commandLine().getParseResult();
CommandLine appCommand = spec.subcommands().get("app");
return appCommand.execute(result.originalArgs().stream().filter(x -> !"create".equals(x)).toArray(String[]::new));
}
}