feat: v1.9.11
This commit is contained in:
@@ -47,6 +47,9 @@ pub struct CmdConfig {
|
||||
/// Show KID
|
||||
#[arg(long)]
|
||||
pub show_kid: bool,
|
||||
/// JSON output
|
||||
#[arg(long)]
|
||||
pub json: bool,
|
||||
/// Encryption profile (use default when --key-filter is assigned)
|
||||
#[arg(long, short = 'p')]
|
||||
pub profile: Option<String>,
|
||||
@@ -55,13 +58,23 @@ pub struct CmdConfig {
|
||||
pub key_filter: Option<String>,
|
||||
}
|
||||
|
||||
pub fn config(cmd_version: CmdConfig) -> XResult<()> {
|
||||
pub fn config(cmd_config: CmdConfig) -> XResult<()> {
|
||||
let config = TinyEncryptConfig::load_default()?;
|
||||
|
||||
if cmd_version.profile.is_some() || cmd_version.key_filter.is_some() {
|
||||
return config_key_filter(&cmd_version, &config);
|
||||
if cmd_config.json {
|
||||
let mut config = config;
|
||||
config.includes = None;
|
||||
if let Some(profiles) = &mut config.profiles {
|
||||
profiles.remove("__all__");
|
||||
}
|
||||
println!("{}", serde_json::to_string_pretty(&config)?);
|
||||
return Ok(());
|
||||
}
|
||||
config_profiles(&cmd_version, &config)
|
||||
|
||||
if cmd_config.profile.is_some() || cmd_config.key_filter.is_some() {
|
||||
return config_key_filter(&cmd_config, &config);
|
||||
}
|
||||
config_profiles(&cmd_config, &config)
|
||||
}
|
||||
|
||||
fn config_key_filter(cmd_version: &CmdConfig, config: &TinyEncryptConfig) -> XResult<()> {
|
||||
|
||||
Reference in New Issue
Block a user