terminal_tools_plus_plus 0.2.1

A collection of enhanced utilities for terminal manipulation and CLI development in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use colored::*;
use std::io::{self, Write};

/// Prompts the user for input and returns the trimmed result.
pub fn get_input(prompt: &str) -> String {
    print!("{} ", prompt.bright_white().italic());
    let _ = io::stdout().flush();

    let mut input = String::new();
    if io::stdin().read_line(&mut input).is_err() {
        return String::new();
    }

    input.trim().to_string()
}