Interface CliCommandProvider


public interface CliCommandProvider
SPI for ext JARs to contribute karate CLI subcommands (e.g. karate serve).

Implementations are discovered by Main via ServiceLoader from the flat classpath the launcher composes (core jar + ext/*.jar). Each contributed command becomes a first-class subcommand of karate, indistinguishable from the built-in run/mock/clean — so it parses its own flags, shows up in help, and is not hijacked by the legacy "bare path → run" default.

Registration: a provider is published the standard ServiceLoader way — a file META-INF/services/io.karatelabs.cli.CliCommandProvider on the ext JAR containing the implementation's fully-qualified class name.

Each object returned by commands() must be a picocli @Command-annotated Callable<Integer> instance (picocli is a core dependency, so it is on the ext's compile classpath). Main registers it with CommandLine#addSubcommand(Object).

  • Method Summary

    Modifier and Type
    Method
    Description
    The subcommands this provider contributes.
  • Method Details

    • commands

      List<Object> commands()
      The subcommands this provider contributes. Each must be a picocli @Command-annotated Callable<Integer> (the @Command(name=...) supplies the subcommand name).