The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Read A Single Character From The Command Line In Rust

TODO: Pull subtitle into page object
Code
use dialoguer::Confirm;

pub fn main() {
    if Confirm::new()
        .with_prompt("Do you want to continue?")
        .interact()
        .unwrap()
    {
        println!("Looks like you want to continue");
    } else {
        println!("nevermind then :(");
    }
}


It took me a while to find this. The references below show some of the things I went through looking for the solution.

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Read A Single Character From The Command Line In Rust

This is for a confirmation prompt using the `dialoguer``
crate.

-- code
-- rust

use dialoguer::Confirm;

pub fn main() {
    if Confirm::new()
        .with_prompt("Do you want to continue?")
        .interact()
        .unwrap()
    {
        println!("Looks like you want to continue");
    } else {
        println!("nevermind then :(");
    }
}




-- p

It took me a while to find this. The
references below show some of the things
I went through looking for the solution.

-- ref
-- url: https://github.com/fdehau/tui-rs

-- ref
-- url: https://doc.rust-lang.org/std/io/trait.Read.html

-- ref
-- url: https://doc.rust-lang.org/std/io/fn.stdin.html

-- ref
-- url: https://doc.rust-lang.org/std/io/struct.Stdin.html

-- ref
-- url: https://docs.rs/tui/latest/tui/terminal/struct.Terminal.html#method.current_buffer_mut

-- ref
-- url: https://github.com/fdehau/tui-rs/blob/master/examples/user_input.rs

-- ref
-- url: https://github.com/fdehau/tui-rs/issues/76

-- ref
-- url: https://github.com/termapps/enquirer

-- ref
-- url: https://github.com/termapps/enquirer/blob/master/src/confirm.rs

-- ref
-- url: https://github.com/termapps/enquirer/blob/master/Cargo.toml

-- ref
-- url: https://docs.rs/dialoguer/latest/dialoguer/


-- ref
-- url: https://docs.rs/dialoguer/latest/dialoguer/struct.Confirm.html

This was the key to getting things to work


-- ref
-- url: https://docs.rs/indicatif/latest/indicatif/

indicatif is a library for Rust that helps you build command line interfaces that report progress to users. It comes with various tools and utilities for formatting anything that indicates progress.

-- ref
-- url: https://docs.rs/console/latest/console/

console is a library for Rust that provides access to various terminal features so you can build nicer looking command line interfaces. It comes with various tools and utilities for working with Terminals and formatting text.

-- ref
-- url: https://docs.rs/rprompt/latest/rprompt/


-- ref
-- url: https://stackoverflow.com/q/26321592/102401

-- ref
-- url: https://docs.rs/text_io/latest/text_io/








-- categories
-- Rust 

-- metadata
-- date: 2023-06-30 16:44:28
-- id: 2rwoqcti
-- site: aws
-- type: post
-- status: draft