git.delta.rocks / fleet / refs/heads / push-kyumtlkprzyo

difftreelog

source

remowt/cmds/remowt-agent/src/askpass.rs750 Bsourcehistory
1use std::borrow::Cow;2use std::io::Write as _;34use bifrostlink::declarative::RemoteEndpoints as _;5use remowt_link_shared::{gateway, Address, BifConfig};6use remowt_ui_prompt::bifrost::PromptEndpointsClient;7use remowt_ui_prompt::{Prompter, Source};89pub async fn ask(prompt: &str, description: String) -> anyhow::Result<()> {10	let rpc = gateway::connect(&gateway::socket_path()?).await?;11	let prompter = PromptEndpointsClient::<BifConfig>::wrap(rpc.remote(Address::User));12	let password = Prompter::prompt_text(13		&prompter,14		false,15		prompt,16		&description,17		&[Source(Cow::Borrowed("remowt-askpass"))],18	)19	.await?;2021	let mut out = std::io::stdout().lock();22	out.write_all(password.as_bytes())?;23	out.write_all(b"\n")?;24	out.flush()?;25	Ok(())26}