forked from NationTech/harmony
fix(secrets): use Inquire::Editor instead of regular text
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user