fix(secrets): use Inquire::Editor instead of regular text

This commit is contained in:
2025-09-09 20:33:39 -04:00
parent 258cfa279e
commit c5f46d676b
3 changed files with 31 additions and 7 deletions

View File

@@ -120,10 +120,26 @@ impl SecretManager {
let ns = &manager.namespace;
let key = T::KEY;
let secret_json = inquire::Text::new(&format!(
"Secret not found for {} {}, paste the JSON here :",
ns, key
let secret_json = inquire::Editor::new(&format!(
"Secret not found for {ns} {key}, paste the JSON here :",
))
.with_formatter(&|data| {
let char_count = data.chars().count();
if char_count == 0 {
String::from("<skipped>")
} else if char_count <= 20 {
data.into()
} else {
let mut substr: String = data.chars().take(17).collect();
substr.push_str("...");
substr
}
})
.with_render_config(
inquire::ui::RenderConfig::default().with_canceled_prompt_indicator(
inquire::ui::Styled::new("<skipped>").with_fg(inquire::ui::Color::DarkYellow),
),
)
.prompt()
.map_err(|e| {
SecretStoreError::Store(format!("Failed to prompt secret {ns} {key} : {e}").into())