Skip to content

Instantly share code, notes, and snippets.

@tobidope
Created February 9, 2020 17:28
Show Gist options
  • Select an option

  • Save tobidope/7db9e94e43922a6f540fb22796f24c24 to your computer and use it in GitHub Desktop.

Select an option

Save tobidope/7db9e94e43922a6f540fb22796f24c24 to your computer and use it in GitHub Desktop.
Nun
package test.picocli;
import io.micronaut.configuration.picocli.PicocliRunner;
import io.micronaut.context.ApplicationContext;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
@Command(name = "test-picocli", description = "...",
mixinStandardHelpOptions = true)
public class TestPicocliCommand implements Runnable {
@Option(names = {"-v", "--verbose"}, description = "...")
boolean verbose;
public static void main(String[] args) throws Exception {
PicocliRunner.run(TestPicocliCommand.class, args);
}
public void run() {
// business logic here
if (verbose) {
System.out.println("Hi!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment