diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index e4d1b6e..d6313fa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,20 +1,23 @@ use crossterm::terminal::size; use std::env; use unicode_width::UnicodeWidthStr; +use clap::Parser; mod mikuart; use mikuart::get_miku_art; -fn main() -> Result<(), Box<dyn std::error::Error>> { - let args: Vec<String> = env::args().collect(); +#[derive(Parser)] +#[command(version, about, long_about = None)] +struct Args { + /// Text to display in the speech bubble + text: String, - if args.len() == 1 { - println!("Usage: mikusays <text>"); - println!("Example: mikusays \"Hello, World!\""); - return Ok(()); - } +} - let text = args[1..].join(" "); +fn main() -> Result<(), Box<dyn std::error::Error>> { + let args = Args::parse(); + + let text = args.text; draw_miku_says(&text)?; Ok(()) |
