Created
April 26, 2020 12:04
-
-
Save dmi3coder/87218f5396bf5503c18eb231bb3dace9 to your computer and use it in GitHub Desktop.
Example of GreetingApplication with Picocli in Quarkus
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; | |
import io.quarkus.runtime.*; | |
import io.quarkus.runtime.annotations.QuarkusMain; | |
import org.acme.getting.started.command.*; | |
import org.apache.maven.shared.utils.cli.CommandLineUtils; | |
import picocli.CommandLine; | |
import javax.inject.Inject; | |
@QuarkusMain | |
public class GreetingApplication implements QuarkusApplication { | |
@Inject | |
GreetingCommand greetingCommand; | |
@Override | |
public int run(String... args) throws Exception { | |
if (args.length == 0) { | |
Quarkus.waitForExit(); | |
return 0; | |
} | |
if (args.length == 1) { | |
args = CommandLineUtils.translateCommandline(args[0]); | |
} | |
return new CommandLine(new QuarkusCommand()) | |
.addSubcommand(greetingCommand) | |
.execute(args); | |
} | |
public static void main(String[] args) { | |
Quarkus.run(GreetingApplication.class, args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment