Skip to content

Instantly share code, notes, and snippets.

@dmi3coder
Created April 23, 2020 19:50
Show Gist options
  • Save dmi3coder/3af656392fe5aaefdd8b0e105dc2f6c5 to your computer and use it in GitHub Desktop.
Save dmi3coder/3af656392fe5aaefdd8b0e105dc2f6c5 to your computer and use it in GitHub Desktop.
Initial example of Quarkus Command mode
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