rpgmv_tool/command/
check_line_size.rs

1use clap::Parser;
2use std::path::PathBuf;
3
4#[derive(Debug, Parser)]
5#[command(about = "Check a game to see if any text lines overflow their boxes")]
6pub struct Options {
7    #[arg(help = "The path to the game to check", default_value = ".")]
8    pub input: PathBuf,
9}
10
11pub fn exec(options: Options) -> anyhow::Result<()> {
12    let options = rpgmv_tool_util::CheckLineSizeOptions::from_game_path(options.input)?;
13    for entry in rpgmv_tool_util::check_line_size(&options)? {
14        let rpgmv_tool_util::CheckLineSizeEntry {
15            file,
16            line,
17            text_width,
18            target_width,
19            suggested_line,
20        } = entry?;
21
22        println!("{file}");
23        println!("  Text: \"{line}\"");
24        println!("  width={text_width} vs target_width={target_width}");
25        println!("  suggested_text=\"{suggested_line}\"");
26    }
27
28    Ok(())
29}