https://github.com/cfsamson/press-btn-continue
Library to eaily add a "Press any key to continue" console prompt to your command line program.
https://github.com/cfsamson/press-btn-continue
Last synced: 3 months ago
JSON representation
Library to eaily add a "Press any key to continue" console prompt to your command line program.
- Host: GitHub
- URL: https://github.com/cfsamson/press-btn-continue
- Owner: cfsamson
- License: mit
- Created: 2021-05-13T21:41:22.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-07-13T05:13:46.000Z (almost 2 years ago)
- Last Synced: 2025-02-28T05:56:24.058Z (4 months ago)
- Language: Rust
- Size: 8.79 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Press any button to continue
Small crate that gives an easy access to the classic Windows "Press any key to
continue" console prompt.There is currently no way to implement this using Rust's standard library. The
closest you can get is to read one character from stdin but the user has to
press "ENTER" to do that so you essentially get "Press ENTER to continue..."
doing like this:```rust
println!("Press ENTER to continue...");
let buffer = &mut [0u8];
std::io::stdin().read_exact(buffer).unwrap();
```This crate provides only one method called `wait` which progresses on any
keypress.```rust
fn main() {
println!("Hello world!");
press_btn_continue::wait("Press any key to continue...").unwrap();
}
```## Compatibility
As of now this library only compiles on Windows but I'd be happy to add support
for other platforms as well later on.## Dependencies
There are no external dependencies. I try to keep this library as lightweight
and transparent as possible (easy to review, and adds very little to compile
times).