feat: optimize code

This commit is contained in:
2023-12-10 14:37:26 +08:00
parent e7a9877cad
commit 26c5a25759
2 changed files with 3 additions and 3 deletions

View File

@@ -103,7 +103,7 @@ pub fn info_single(path: &PathBuf, cmd_info: &CmdInfo, config: &Option<TinyEncry
envelops.iter().enumerate().for_each(|(i, envelop)| {
infos.push(format!("{}: {}",
header(&format!("Envelop #{}", i + 1)),
util_envelop::format_envelop(envelop, &config)
util_envelop::format_envelop(envelop, config)
));
util_msg::when_debug(|| {
if let Ok(wrap_key) = WrapKey::parse(&envelop.encrypted_key) {

View File

@@ -1,6 +1,6 @@
use std::env;
use rust_util::{debugging, iff, warning};
use rust_util::{debugging, util_env, warning};
use rust_util::util_env as rust_util_env;
use crate::consts;
@@ -41,7 +41,7 @@ pub fn get_auto_select_key_ids() -> Option<Vec<String>> {
}
pub fn get_default_compress() -> Option<bool> {
iff!(rust_util_env::is_env_off(TINY_ENCRYPT_ENV_DEFAULT_COMPRESS), Some(true), None)
env::var(TINY_ENCRYPT_ENV_DEFAULT_COMPRESS).ok().map(|val| util_env::is_on(&val))
}
pub fn get_no_progress() -> bool {