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

io.quarkus.cli.ProjectExtensions Maven / Gradle / Ivy

There is a newer version: 3.15.0
Show newest version
package io.quarkus.cli;

import java.util.List;
import java.util.concurrent.Callable;
import java.util.stream.Collectors;

import io.quarkus.cli.common.OutputOptionMixin;
import picocli.CommandLine;
import picocli.CommandLine.ParseResult;
import picocli.CommandLine.Unmatched;

@CommandLine.Command(name = "extension", aliases = {
        "ext" }, header = "Configure extensions of an existing project.", subcommands = {
                ProjectExtensionsList.class,
                ProjectExtensionsCategories.class,
                ProjectExtensionsAdd.class,
                ProjectExtensionsRemove.class })
public class ProjectExtensions implements Callable {

    @CommandLine.Mixin(name = "output")
    protected OutputOptionMixin output;

    @CommandLine.Spec
    protected CommandLine.Model.CommandSpec spec;

    @Unmatched // avoids throwing errors for unmatched arguments
    List unmatchedArgs;

    @Override
    public Integer call() throws Exception {
        output.info("Listing extensions (default action, see --help).");

        ParseResult result = spec.commandLine().getParseResult();
        List args = result.originalArgs().stream().filter(x -> !"extension".equals(x) && !"ext".equals(x))
                .collect(Collectors.toList());
        CommandLine listCommand = spec.subcommands().get("list");
        return listCommand.execute(args.toArray(new String[0]));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy