import com.github.rvesse.airline.SingleCommand; import com.github.rvense.airline.annotations.Command; import com.github.rvense.airline.annotations.Option; @Command(name = "hello", description = "Prints a greeting") public class HelloCommand implements Runnable { @Option(name = {"-n", "--name"}, description = "The name to greet") private String name; public void run() { if (name != null) { System.out.println("Hello, " + name + "!"); } else { System.out.println("Hello!"); } } public static void main(String[] args) { SingleCommand<HelloCommand> parser = SingleCommand.singleCommand(HelloCommand.class); parser.parse(args).run(); } }


上一篇:
下一篇:
切换中文