in backup-command/src/main/java/org/apache/iotdb/backup/command/ImportTool.java [98:133]
public static void init(String[] args) {
Options options = createOptions();
HelpFormatter hf = new HelpFormatter();
hf.setOptionComparator(null);
hf.setWidth(MAX_HELP_CONSOLE_WIDTH);
CommandLine commandLine = null;
CommandLineParser parser = new DefaultParser();
if (args == null || args.length == 0) {
System.out.println("Too few params input, please check the following hint.");
hf.printHelp(TSFILEDB_CLI_PREFIX, options, true);
System.exit(CODE_ERROR);
}
try {
commandLine = parser.parse(options, args);
} catch (org.apache.commons.cli.ParseException e) {
System.out.println("Parse error: " + e.getMessage());
hf.printHelp(TSFILEDB_CLI_PREFIX, options, true);
System.exit(CODE_ERROR);
}
if (commandLine.hasOption(HELP_ARGS)) {
hf.printHelp(TSFILEDB_CLI_PREFIX, options, true);
System.exit(CODE_ERROR);
}
try {
parseBasicParams(commandLine);
parseSpecialParams(commandLine);
} catch (ArgsErrorException e) {
System.out.println("Args error: " + e.getMessage());
System.exit(CODE_ERROR);
} catch (Exception e) {
System.out.println("Encounter an error, because: " + e.getMessage());
System.exit(CODE_ERROR);
}
}