feat: v0.4.2, add --direct-print

This commit is contained in:
2023-10-16 23:57:24 +08:00
parent b4d9b4692b
commit 9db0cec508
6 changed files with 51 additions and 760 deletions

View File

@@ -12,7 +12,7 @@ pub fn format_envelop(envelop: &TinyEncryptEnvelop, config: &Option<TinyEncryptC
let desc = envelop_desc.as_ref()
.map(|desc| format!(", Desc: {}", desc))
.unwrap_or_else(|| "".to_string());
format!("{}{}{}", with_with(&envelop.r#type.get_upper_name(), 10), envelop_kid, desc)
format!("{}{}{}", with_width_type(&envelop.r#type.get_upper_name()), envelop_kid, desc)
}
fn get_envelop_desc(envelop: &TinyEncryptEnvelop, config_envelop: &Option<&TinyEncryptConfigEnvelop>) -> Option<String> {
@@ -25,6 +25,10 @@ fn get_envelop_desc(envelop: &TinyEncryptEnvelop, config_envelop: &Option<&TinyE
None
}
fn with_with(s: &str, width: usize) -> String {
pub fn with_width_type(s: &str) -> String {
with_width(s, 10)
}
pub fn with_width(s: &str, width: usize) -> String {
iff!(s.len() < width, format!("{}{}", s, " ".repeat(width - s.len())), s.to_string())
}