feaat: v1.9.13, add temporary key for simple encrypt

This commit is contained in:
2025-09-14 15:29:07 +08:00
parent c8175e2654
commit 75ed193d86
8 changed files with 121 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ use tabled::{Table, Tabled};
use tabled::settings::Style;
use crate::config::TinyEncryptConfig;
use crate::temporary_key::serialize_config_envelop;
use crate::util_envelop;
#[derive(Tabled, Eq)]
@@ -50,6 +51,9 @@ pub struct CmdConfig {
/// JSON output
#[arg(long)]
pub json: bool,
/// Temporary key output
#[arg(long)]
pub temporary_key: bool,
/// Encryption profile (use default when --key-filter is assigned)
#[arg(long, short = 'p')]
pub profile: Option<String>,
@@ -71,6 +75,14 @@ pub fn config(cmd_config: CmdConfig) -> XResult<()> {
return Ok(());
}
if cmd_config.temporary_key {
for envelop in &config.envelops {
let k = serialize_config_envelop(envelop);
println!("{}", k);
}
return Ok(());
}
if cmd_config.profile.is_some() || cmd_config.key_filter.is_some() {
return config_key_filter(&cmd_config, &config);
}