Run cargo fmt
This commit is contained in:
1 parent
feb0a2076c
commit
7a3ed2ba02
2 files changed
+13
-5
No files matched your search
+3
-3
@@ -1,7 +1,7 @@
|
||||
use clap::Parser;
|
||||
use crossterm::terminal::size;
|
||||
use std::env;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
use clap::Parser;
|
||||
|
||||
mod mikuart;
|
||||
use mikuart::get_miku_art;
|
||||
@@ -19,11 +19,11 @@ struct Args {
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let args = Args::parse();
|
||||
|
||||
|
||||
let text = args.text;
|
||||
let style = match args.style {
|
||||
Some(s) => s,
|
||||
None => -1 // Default to -1 to select a random style
|
||||
None => -1, // Default to -1 to select a random style
|
||||
};
|
||||
draw_miku_says(&text, style)?;
|
||||
|
||||
|
||||
+10
-2
@@ -505,8 +505,16 @@ pub fn get_miku_art(style: i32) -> Vec<&'static str> {
|
||||
];
|
||||
|
||||
if style > 0 && style as usize >= styles.len() {
|
||||
panic!("Style {} does not exist! Chooese one below {}", style, styles.len());
|
||||
panic!(
|
||||
"Style {} does not exist! Chooese one below {}",
|
||||
style,
|
||||
styles.len()
|
||||
);
|
||||
}
|
||||
let selected_style = if style < 0 { rng.random_range(0..styles.len()) } else { style as usize };
|
||||
let selected_style = if style < 0 {
|
||||
rng.random_range(0..styles.len())
|
||||
} else {
|
||||
style as usize
|
||||
};
|
||||
styles[selected_style].clone()
|
||||
}
|
||||
Reference in new issue
Block a user