feat: v0.7.3, parse args error message improvement

This commit is contained in:
2023-04-02 21:20:55 +08:00
parent da45deccb9
commit abb2480b0d
2 changed files with 13 additions and 2 deletions

View File

@@ -1,13 +1,24 @@
package me.hatter.tools.tinyencrypt; package me.hatter.tools.tinyencrypt;
import me.hatter.tools.commons.io.RFile; import me.hatter.tools.commons.io.RFile;
import me.hatter.tools.commons.log.LogTool;
import me.hatter.tools.commons.log.LogTools;
import picocli.CommandLine; import picocli.CommandLine;
public class TinyEncryptArgsUtil { public class TinyEncryptArgsUtil {
private static final LogTool log = LogTools.getLogTool(TinyEncryptArgsUtil.class);
private static final String DEFAULT_TINY_ENCRYPT_CONFIG = "~/.tinyencrypt_config.json"; private static final String DEFAULT_TINY_ENCRYPT_CONFIG = "~/.tinyencrypt_config.json";
public static TinyEncryptArgs parseTinyEncryptArgs(String[] args) { public static TinyEncryptArgs parseTinyEncryptArgs(String[] args) {
try {
return innerParseTinyEncryptArgs(args);
} catch (CommandLine.UnmatchedArgumentException unmatchedArgumentException) {
log.error("Parse args failed: " + unmatchedArgumentException.getMessage());
return null;
}
}
public static TinyEncryptArgs innerParseTinyEncryptArgs(String[] args) {
final TinyEncryptArgs tinyEncryptArgs = new TinyEncryptArgs(); final TinyEncryptArgs tinyEncryptArgs = new TinyEncryptArgs();
final CommandLine cmd = new CommandLine(tinyEncryptArgs); final CommandLine cmd = new CommandLine(tinyEncryptArgs);
cmd.parseArgs(args); cmd.parseArgs(args);

View File

@@ -1,7 +1,7 @@
package me.hatter.tools.tinyencrypt.config; package me.hatter.tools.tinyencrypt.config;
public class TinyEncryptConstant { public class TinyEncryptConstant {
public static final String VERSION = "0.7.2"; public static final String VERSION = "0.7.3";
public static final String ENC_FILE_EXT = ".tinyenc"; public static final String ENC_FILE_EXT = ".tinyenc";
} }