2024-01-16 02:44:48 +00:00
|
|
|
//!
|
|
|
|
|
2024-01-10 20:13:42 +00:00
|
|
|
use std::io::{stdin, stdout};
|
2023-12-21 17:04:35 +00:00
|
|
|
|
2024-01-10 20:13:42 +00:00
|
|
|
use keyfork_prompt::{
|
2024-08-01 11:16:05 +00:00
|
|
|
MaybeIdentifier, PromptHandler, Terminal,
|
2024-01-10 20:13:42 +00:00
|
|
|
};
|
2023-12-21 17:04:35 +00:00
|
|
|
|
2024-08-01 11:16:05 +00:00
|
|
|
#[derive(PartialEq, Eq, Debug)]
|
|
|
|
pub enum Example {
|
|
|
|
RetryQR,
|
|
|
|
UseMnemonic,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl MaybeIdentifier for Example {}
|
|
|
|
|
|
|
|
impl std::fmt::Display for Example {
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
match self {
|
|
|
|
Example::RetryQR => f.write_str("Retry QR Code"),
|
|
|
|
Example::UseMnemonic => f.write_str("Use Mnemonic"),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-02-19 10:20:33 +00:00
|
|
|
|
2024-01-07 04:23:41 +00:00
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
2024-01-11 03:35:31 +00:00
|
|
|
let mut mgr = Terminal::new(stdin(), stdout())?;
|
2024-01-10 20:13:42 +00:00
|
|
|
|
2024-08-01 11:16:05 +00:00
|
|
|
let choice = mgr.prompt_choice(
|
|
|
|
"Unable to detect QR code.",
|
|
|
|
&[Example::RetryQR, Example::UseMnemonic],
|
2024-01-10 20:13:42 +00:00
|
|
|
)?;
|
2024-08-01 11:16:05 +00:00
|
|
|
dbg!(choice);
|
2024-01-10 20:13:42 +00:00
|
|
|
|
2023-12-21 17:04:35 +00:00
|
|
|
Ok(())
|
|
|
|
}
|