Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/c1m50c/catch-input
Rust library implementing an easy to use macro that gets input from the console.
https://github.com/c1m50c/catch-input
catch-input cli console crates crates-io get-input input rust rustlang shell terminal
Last synced: about 1 month ago
JSON representation
Rust library implementing an easy to use macro that gets input from the console.
- Host: GitHub
- URL: https://github.com/c1m50c/catch-input
- Owner: c1m50c
- License: mit
- Created: 2022-04-10T02:21:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-11T03:13:55.000Z (over 2 years ago)
- Last Synced: 2024-09-30T12:04:46.935Z (about 2 months ago)
- Topics: catch-input, cli, console, crates, crates-io, get-input, input, rust, rustlang, shell, terminal
- Language: Rust
- Homepage: https://crates.io/crates/catch-input
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# **catch-input**
![Crates.io Version](https://img.shields.io/crates/v/catch-input?color=orange&style=for-the-badge)
![Crates.io License](https://img.shields.io/crates/l/catch-input?style=for-the-badge)
![Lines of Code](https://img.shields.io/tokei/lines/github/c1m50c/catch-input?style=for-the-badge)Rust library implementing a macro for retrieving user input from the console.
## **Example**
```rust
use catch_input::input;fn main() {
let a = input!("PromptA => ");
let b = input!(|| { print!("PromptB => ") });
let c = input!((String::from("PromptC => ")));assert!(a, String::from("Catch"));
assert!(b, String::from("Input"));
assert!(c, String::from("Crate"));println!(">> {} : {} : {}", a, b, c);
}
``````bash
$ cargo run
...PromptA => Catch
PromptB => Input
PromptC => Crate
>> Catch : Input : Crate
```