public class CommandLineArguments { @Option(shortName = "f", longName = "file", description = "Input file path") private String filePath; @Option(shortName = "n", longName = "number", defaultValue = "0", description = "Number of iterations") private int numIterations; // Getters and setters for the fields // ... } public class Main { public static void main(String[] args) { CommandLineArguments commandLineArgs = new CommandLineArguments(); CliFactory.parseArguments(commandLineArgs, args); // Access and use the parsed command line arguments String filePath = commandLineArgs.getFilePath(); int numIterations = commandLineArgs.getNumIterations(); // Perform necessary operations based on the parsed arguments // ... } }


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