From 1f8a366b6c8b8e6af84c31137d6a439b82fc7017 Mon Sep 17 00:00:00 2001 From: Jaby Blubb Date: Sun, 25 Jun 2023 16:38:29 +0200 Subject: [PATCH] Detect sections; Unify printing help across the tools --- src/Tools/Tools.code-workspace | 7 ++++++- src/Tools/cpp_out/src/main.rs | 2 +- src/Tools/jaby_engine_fconv/src/main.rs | 2 +- src/Tools/mkoverlay/src/main.rs | 2 +- src/Tools/psxcdgen_ex/src/main.rs | 2 +- src/Tools/readmap/src/lib.rs | 9 +++++++++ src/Tools/readmap/src/main.rs | 2 +- src/Tools/tool_helper/src/lib.rs | 4 ++-- src/Tools/wslpath/src/main.rs | 2 +- 9 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/Tools/Tools.code-workspace b/src/Tools/Tools.code-workspace index dd890969..aed8c246 100644 --- a/src/Tools/Tools.code-workspace +++ b/src/Tools/Tools.code-workspace @@ -78,7 +78,12 @@ { "id": "cargo run args", "type": "pickString", - "options": ["", "--help", "--list -o ../Tests/Test_Planschbecken psx bin-cue ../Tests/ISO_Planschbecken.xml"], + "options": [ + "", + "--help", + "--list -o ../Tests/Test_Planschbecken psx bin-cue ../Tests/ISO_Planschbecken.xml", + "${workspaceFolder}/../../examples/PoolBox/application/bin/PSX-release/PoolBox.map" + ], "default": "", "description": "Argument options to pass to cargo run" } diff --git a/src/Tools/cpp_out/src/main.rs b/src/Tools/cpp_out/src/main.rs index 819fbe71..2c21a29f 100644 --- a/src/Tools/cpp_out/src/main.rs +++ b/src/Tools/cpp_out/src/main.rs @@ -47,6 +47,6 @@ fn main() { exit_with_error(error) } }, - Err(error) => eprintln!("{}", error) + Err(error) => println!("{}", error) } } \ No newline at end of file diff --git a/src/Tools/jaby_engine_fconv/src/main.rs b/src/Tools/jaby_engine_fconv/src/main.rs index 8605bc01..6c43534b 100644 --- a/src/Tools/jaby_engine_fconv/src/main.rs +++ b/src/Tools/jaby_engine_fconv/src/main.rs @@ -64,6 +64,6 @@ fn main() { exit_with_error(error); } }, - Err(error) => eprintln!("{}", error) + Err(error) => println!("{}", error) } } \ No newline at end of file diff --git a/src/Tools/mkoverlay/src/main.rs b/src/Tools/mkoverlay/src/main.rs index f7fd6224..a0997b86 100644 --- a/src/Tools/mkoverlay/src/main.rs +++ b/src/Tools/mkoverlay/src/main.rs @@ -45,7 +45,7 @@ fn main() { } }, Err(error) => { - exit_with_error(Error::from_error(error)); + println!("{}", error) } } } \ No newline at end of file diff --git a/src/Tools/psxcdgen_ex/src/main.rs b/src/Tools/psxcdgen_ex/src/main.rs index cf1a4a49..186e7790 100644 --- a/src/Tools/psxcdgen_ex/src/main.rs +++ b/src/Tools/psxcdgen_ex/src/main.rs @@ -60,7 +60,7 @@ fn main() { } }, Err(error) => { - eprintln!("{}", error) + println!("{}", error) } } } \ No newline at end of file diff --git a/src/Tools/readmap/src/lib.rs b/src/Tools/readmap/src/lib.rs index 0b8d4e9c..e1bf80e3 100644 --- a/src/Tools/readmap/src/lib.rs +++ b/src/Tools/readmap/src/lib.rs @@ -1,8 +1,17 @@ pub mod types; use tool_helper::{Error, Input}; +use std::io::BufRead; use types::Section; pub fn scan(input: Input) -> Result, Error> { + let lines = input.lines().map(|l| l.unwrap()); + + for line in lines { + if line.starts_with('.') { + println!("Found section \"{}\"", line); + } + } + Err(Error::not_implemented("readmap::scan")) } diff --git a/src/Tools/readmap/src/main.rs b/src/Tools/readmap/src/main.rs index bbc4b0e9..99045765 100644 --- a/src/Tools/readmap/src/main.rs +++ b/src/Tools/readmap/src/main.rs @@ -25,7 +25,7 @@ pub fn main() { } }, Err(error) => { - exit_with_error(Error::from_error(error)); + println!("{}", error) } } } \ No newline at end of file diff --git a/src/Tools/tool_helper/src/lib.rs b/src/Tools/tool_helper/src/lib.rs index 59a6075c..12d8c1a6 100644 --- a/src/Tools/tool_helper/src/lib.rs +++ b/src/Tools/tool_helper/src/lib.rs @@ -1,6 +1,6 @@ use colored::*; use envmnt::{ExpandOptions, ExpansionType}; -use std::{boxed::Box, io::{BufReader, BufWriter, Read, Write}, path::PathBuf}; +use std::{boxed::Box, io::{BufRead, BufReader, BufWriter, Read, Write}, path::PathBuf}; pub mod bits; pub mod compress; @@ -8,7 +8,7 @@ pub mod raw; pub type BufferedInputFile = BufReader; pub type Output = Box; -pub type Input = Box; +pub type Input = Box; #[macro_export] macro_rules! format_if_error { diff --git a/src/Tools/wslpath/src/main.rs b/src/Tools/wslpath/src/main.rs index c9f05efe..18017545 100644 --- a/src/Tools/wslpath/src/main.rs +++ b/src/Tools/wslpath/src/main.rs @@ -13,7 +13,7 @@ fn main() { print!("{}", wslpath::convert(cmd_line.path_string)); }, Err(error) => { - eprintln!("{}", error); + println!("{}", error); } } } \ No newline at end of file