diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index f5c0722..d03eb2c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,9 @@ use rand::{Rng, thread_rng}; #[derive(Parser)] struct Args { + /// Turns all text into lowercase (NOOB mode) + #[arg(short, long)] + lower: bool, quote: String, } @@ -41,12 +44,12 @@ fn generate_quotes(path: &Path) -> Result<Vec<String>, Box<dyn Error>> { #[tokio::main] async fn main() -> Result<(), Box<dyn Error>> { - let quote = if !stdin().is_terminal() { + let args = Args::parse(); + let mut quote = if !stdin().is_terminal() { let mut b = Vec::new(); stdin().read_to_end(&mut b).unwrap(); String::from_utf8(b).unwrap() } else { - let args = Args::parse(); let path = Path::new(&args.quote); let mut quotes = generate_quotes(path).unwrap(); let mut rng = thread_rng(); @@ -54,6 +57,10 @@ async fn main() -> Result<(), Box<dyn Error>> { quotes.remove(chosen) }; + if args.lower { + quote = quote.to_lowercase(); + } + // TODO Add more options to choose quotes let mut app = App::new("e); |
