Skip to content

Instantly share code, notes, and snippets.

@dmi3coder
Created April 26, 2020 11:50
Show Gist options
  • Save dmi3coder/ac35ff11435dfb7dac58c27bdb814c6b to your computer and use it in GitHub Desktop.
Save dmi3coder/ac35ff11435dfb7dac58c27bdb814c6b to your computer and use it in GitHub Desktop.
Example of GreetingCommand in Quarkus Command mode
package org.acme.getting.started.command;
import org.acme.getting.started.GreetingService;
import picocli.CommandLine;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;
@Dependent
@CommandLine.Command(name = "greet", mixinStandardHelpOptions = true, description = "Greet person by their name")
public class GreetingCommand implements Runnable {
@CommandLine.Option(names = {"-n", "--name"}, description = "Specify which user to greet")
String name;
@Inject
GreetingService greetingService;
@Override
public void run() {
System.out.println(greetingService.greeting(name));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment