feat: optimize code
This commit is contained in:
@@ -103,7 +103,7 @@ pub fn info_single(path: &PathBuf, cmd_info: &CmdInfo, config: &Option<TinyEncry
|
|||||||
envelops.iter().enumerate().for_each(|(i, envelop)| {
|
envelops.iter().enumerate().for_each(|(i, envelop)| {
|
||||||
infos.push(format!("{}: {}",
|
infos.push(format!("{}: {}",
|
||||||
header(&format!("Envelop #{}", i + 1)),
|
header(&format!("Envelop #{}", i + 1)),
|
||||||
util_envelop::format_envelop(envelop, &config)
|
util_envelop::format_envelop(envelop, config)
|
||||||
));
|
));
|
||||||
util_msg::when_debug(|| {
|
util_msg::when_debug(|| {
|
||||||
if let Ok(wrap_key) = WrapKey::parse(&envelop.encrypted_key) {
|
if let Ok(wrap_key) = WrapKey::parse(&envelop.encrypted_key) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::env;
|
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 rust_util::util_env as rust_util_env;
|
||||||
|
|
||||||
use crate::consts;
|
use crate::consts;
|
||||||
@@ -41,7 +41,7 @@ pub fn get_auto_select_key_ids() -> Option<Vec<String>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_default_compress() -> Option<bool> {
|
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 {
|
pub fn get_no_progress() -> bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user