New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
await repetition #83
Comments
pub(crate) async fn subcommand_print_peer_handler(_config: String) -> anyhow::Result<()> {
let mut configuration = <Configuration as AsyncTryFrom<String>>::try_from(_config).await?;
let node_type_select = inquire::Select::new(
"Select the node configuration to print",
vec![PEER_TYPE, PEER_SERVER_TYPE],
)
.prompt();
match node_type_select {
Ok(node_type) => {
match node_type {
PEER_TYPE => {
let node_list = configuration.list().await?;
let mut node_option = node_list.iter().map(|v| v.name()).collect::<Vec<&str>>();
node_option.sort();
let option = inquire::Select::new("select peer", node_option)
.with_help_message(
"This will print the configuration and generate the QR code",
)
.prompt();
match option {
Ok(node_name) => {
let string = configuration.peer_str(node_name).await?;
println!("generated configuration:\n{}\n", string);
qr2term::print_qr(string)
.context("Failed to generate QRCode configuration")?;
}
Err(_) => {}
}
}
PEER_SERVER_TYPE => {
let string = configuration.peer_server_str().await?;
println!("{}", string);
}
_ => {
println!("Unable to find matching node type")
}
}
drop(configuration);
}
Err(_) => {
println!("please try again")
}
}
Ok(())
} |
Hey! I haven't taken a deep look yet, but would it possible to write me a sample that I could reproduce locally? I'll try to work on it this weekend |
> git clone https://github.com/gngpp/wgsdc.git && cd wgsdc
> cargo run --example demo
|
|
I did some digging and I'm afraid there isn't anything inquire can do to avoid that. When Executing |
That's all. Thank you very much for your reply |
question:call function await on match, prompt repeats.
code:
The text was updated successfully, but these errors were encountered: