From 2c269b15728ef78e1694e4acc8e62c9ae5702e6d680514f6d70bc051b709c970 Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Sat, 20 Apr 2024 00:00:00 +0000 Subject: Format code with cargo fmt --- src/main.rs | 82 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 87274af..3732b50 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,22 +1,22 @@ /* - hitomezashi-rs Generates classical colored Hitomezashi stitch patterns - Copyright (C) 2024 Nicholas Johnson + hitomezashi-rs Generates classical colored Hitomezashi stitch patterns + Copyright (C) 2024 Nicholas Johnson - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ -use clap::{Parser, value_parser}; +use clap::{value_parser, Parser}; use colored::Colorize; use std::process::exit; @@ -25,54 +25,54 @@ mod hitomezashi; #[derive(Parser)] #[command(version, about, long_about = None)] // Read from `Cargo.toml` struct Cli { - /// Pattern width - #[arg(value_parser = value_parser!(usize))] - width: usize, + /// Pattern width + #[arg(value_parser = value_parser!(usize))] + width: usize, - /// Pattern height - #[arg(value_parser = value_parser!(usize))] - height: usize, + /// Pattern height + #[arg(value_parser = value_parser!(usize))] + height: usize, - #[arg(short, long)] - #[arg(default_value_t = 0.5)] - #[arg(value_parser = value_parser!(f64))] - /// Set skew - skew: f64, + #[arg(short, long)] + #[arg(default_value_t = 0.5)] + #[arg(value_parser = value_parser!(f64))] + /// Set skew + skew: f64, } /* CLI for hitomezashi */ fn main() { - let cli = Cli::parse(); + let cli = Cli::parse(); - // validate bounds of width [1..] - if cli.width < 1 { - println!("{} invalid value '{}' for '{}': valid values are [1..]\n\nFor more information, try '{}'.", + // validate bounds of width [1..] + if cli.width < 1 { + println!("{} invalid value '{}' for '{}': valid values are [1..]\n\nFor more information, try '{}'.", "error:".red().bold(), cli.width.to_string().yellow(), "".bold(), "--help".bold()); - exit(2); - } + exit(2); + } - // validate bounds of height [1..] - if cli.height < 1 { - println!("{} invalid value '{}' for '{}': valid values are [1..]\n\nFor more information, try '{}'.", + // validate bounds of height [1..] + if cli.height < 1 { + println!("{} invalid value '{}' for '{}': valid values are [1..]\n\nFor more information, try '{}'.", "error:".red().bold(), cli.height.to_string().yellow(), "".bold(), "--help".bold()); - exit(2); - } + exit(2); + } - // validate bounds of skew [0-1] - if cli.skew < 0.0 || cli.skew > 1.0 { - println!("{} invalid value '{}' for '{}': valid values are [0-1]\n\nFor more information, try '{}'.", + // validate bounds of skew [0-1] + if cli.skew < 0.0 || cli.skew > 1.0 { + println!("{} invalid value '{}' for '{}': valid values are [0-1]\n\nFor more information, try '{}'.", "error:".red().bold(), cli.skew.to_string().yellow(), "--skew ".bold(), "--help".bold()); - exit(2); - } + exit(2); + } - hitomezashi::hitomezashi(cli.width, cli.height, Some(cli.skew)); + hitomezashi::hitomezashi(cli.width, cli.height, Some(cli.skew)); } -- cgit v1.2.3