Created
April 26, 2020 11:50
-
-
Save dmi3coder/ac35ff11435dfb7dac58c27bdb814c6b to your computer and use it in GitHub Desktop.
Example of GreetingCommand in Quarkus Command mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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