feat: v0.7.1, add --info-json
This commit is contained in:
@@ -64,6 +64,9 @@ public class TinyEncryptArgs {
|
||||
@CommandLine.Option(names = {"-I", "--info"}, description = "Encrypt file info")
|
||||
boolean fileInfo = false;
|
||||
|
||||
@CommandLine.Option(names = {"--info-json"}, description = "Encrypt file info JSON")
|
||||
boolean fileInfoJson = false;
|
||||
|
||||
@CommandLine.Option(names = {"-P", "--pgp"}, description = "Decrypt use PGP")
|
||||
boolean pgp = false;
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class TinyEncryptMainUtil {
|
||||
} else {
|
||||
try {
|
||||
try (FileInputStream fis = new FileInputStream(f)) {
|
||||
printOneFileInfo(f, fis);
|
||||
printOneFileInfo(f, fis, tinyEncryptArgs.fileInfoJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("Read tiny encrypt file failed: " + e.getMessage() + ", file: " + f);
|
||||
@@ -158,10 +158,13 @@ public class TinyEncryptMainUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static void printOneFileInfo(File f, FileInputStream fis) throws IOException {
|
||||
private static void printOneFileInfo(File f, FileInputStream fis, boolean json) throws IOException {
|
||||
final Tlv tlv = TlvUtil.readTlv(fis);
|
||||
final TinyEncryptMeta meta = tlv.getValueAsBytes().asJSONObject(TinyEncryptMeta.class);
|
||||
log.debug("Tiny encrypt meta: " + JSON.toJSONString(meta, true));
|
||||
if (!log.isDebugEnable() && json) {
|
||||
log.info("Tiny encrypt meta: " + JSON.toJSONString(meta, true));
|
||||
}
|
||||
final StringBuilder sb = new StringBuilder(256);
|
||||
sb.append("Tiny Encrypt File Info\n");
|
||||
sb.append(header("File")).append(f);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.hatter.tools.tinyencrypt.config;
|
||||
|
||||
public class TinyEncryptConstant {
|
||||
public static final String VERSION = "0.7.0";
|
||||
public static final String VERSION = "0.7.1";
|
||||
|
||||
public static final String ENC_FILE_EXT = ".tinyenc";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user