From 5dda54ecd49a43e79a52ded2a0fc0f1017689197 Mon Sep 17 00:00:00 2001 From: Strubbelkopp Date: Fri, 25 Jul 2025 12:20:17 +0200 Subject: Add optional argument to select a specific style --- src/main.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index d6313fa..715d34b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,20 +12,27 @@ struct Args { /// Text to display in the speech bubble text: String, + /// Style of the Miku art. Random is chosen if not specified. + #[arg(short, long)] + style: Option, } fn main() -> Result<(), Box> { let args = Args::parse(); let text = args.text; - draw_miku_says(&text)?; + let style = match args.style { + Some(s) => s, + None => -1 // Default to -1 to select a random style + }; + draw_miku_says(&text, style)?; Ok(()) } -fn draw_miku_says(text: &str) -> Result<(), Box> { +fn draw_miku_says(text: &str, style: i32) -> Result<(), Box> { let speech_bubble_lines = get_speech_bubble_lines(text); - let miku_art = get_miku_art(); + let miku_art = get_miku_art(style); let (window_width, window_height) = size()?; let available_width = window_width as usize; -- cgit v1.3-2-g0d8e