Created
April 23, 2020 19:50
-
-
Save dmi3coder/3af656392fe5aaefdd8b0e105dc2f6c5 to your computer and use it in GitHub Desktop.
Initial example of 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; | |
import io.quarkus.runtime.QuarkusApplication; | |
import io.quarkus.runtime.annotations.QuarkusMain; | |
import org.jboss.logging.Logger; | |
@QuarkusMain | |
public class GreetingApplication implements QuarkusApplication { | |
public static final Logger LOGGER = Logger.getLogger(GreetingApplication.class); | |
@Override | |
public int run(String... args) throws Exception { | |
if (args[0].equals("--help")) { | |
LOGGER.info( | |
"\nThis tool helps greet users by their name\n" + | |
"Available commands:\n" + | |
"\t--help\t\t\tShow helpful message\n" + | |
"\t--greet={name}\t\tGreet person by their name" | |
); | |
return 0; | |
} | |
if (args[0].startsWith("--greet")) { | |
String name = args[0].substring(8); | |
LOGGER.info("hello" + name); | |
return 0; | |
} | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment