Kevin Lee 6 月之前
父节点
当前提交
7eafef5530
共有 1 个文件被更改,包括 30 次插入29 次删除
  1. 30 29
      src/main.rs

+ 30 - 29
src/main.rs

@@ -47,6 +47,36 @@ struct DiffCmd {
     diff_file: PathBuf,
 }
 
+/// Queries input .mlp file for pen or object info
+#[derive(Debug, Args)]
+struct QueryCmd {
+    /// Print info for pens
+    #[arg(short, long)]
+    #[arg(value_parser = parse_range)]
+    pen: Option<RangeInclusive<usize>>,
+
+    /// Print info for objects
+    #[arg(short, long)]
+    object: Option<usize>,
+
+    /// Object layer to query object on
+    #[arg(short = 'b', long)]
+    object_layer: Option<usize>,
+}
+
+/// Applies configuration YAML to input .mlp file
+#[derive(Debug, Args)]
+struct ApplyConfig {
+    /// Configuration file
+    #[arg(short, long)]
+    config: PathBuf,
+
+    /// Output file to write to
+    #[arg(short, long)]
+    output: Option<PathBuf>,
+}
+
+/// Helper function to parse a string as an RangeInclusive<usize>
 fn parse_range(arg: &str) -> Result<RangeInclusive<usize>, Error> {
     let re: Regex = Regex::new(r"(\d+)?(\.{2})?(=)?(\d+)?").unwrap();
     const PEN_MAX: usize = 255;
@@ -84,35 +114,6 @@ fn parse_range(arg: &str) -> Result<RangeInclusive<usize>, Error> {
     }
 }
 
-/// Queries input .mlp file for pen or object info
-#[derive(Debug, Args)]
-struct QueryCmd {
-    /// Print info for pens
-    #[arg(short, long)]
-    #[arg(value_parser = parse_range)]
-    pen: Option<RangeInclusive<usize>>,
-
-    /// Print info for objects
-    #[arg(short, long)]
-    object: Option<usize>,
-
-    /// Object layer to query object on
-    #[arg(short = 'b', long)]
-    object_layer: Option<usize>,
-}
-
-/// Applies configuration YAML to input .mlp file
-#[derive(Debug, Args)]
-struct ApplyConfig {
-    /// Configuration file
-    #[arg(short, long)]
-    config: PathBuf,
-
-    /// Output file to write to
-    #[arg(short, long)]
-    output: Option<PathBuf>,
-}
-
 fn main() {
     let cli: Cli = Cli::parse();