Detect sections; Unify printing help across the tools

This commit is contained in:
Jaby 2023-06-25 16:38:29 +02:00 committed by Jaby
parent 1d984e0766
commit 32d324430d
9 changed files with 23 additions and 9 deletions

View File

@ -78,7 +78,12 @@
{ {
"id": "cargo run args", "id": "cargo run args",
"type": "pickString", "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": "", "default": "",
"description": "Argument options to pass to cargo run" "description": "Argument options to pass to cargo run"
} }

View File

@ -47,6 +47,6 @@ fn main() {
exit_with_error(error) exit_with_error(error)
} }
}, },
Err(error) => eprintln!("{}", error) Err(error) => println!("{}", error)
} }
} }

View File

@ -64,6 +64,6 @@ fn main() {
exit_with_error(error); exit_with_error(error);
} }
}, },
Err(error) => eprintln!("{}", error) Err(error) => println!("{}", error)
} }
} }

View File

@ -45,7 +45,7 @@ fn main() {
} }
}, },
Err(error) => { Err(error) => {
exit_with_error(Error::from_error(error)); println!("{}", error)
} }
} }
} }

View File

@ -60,7 +60,7 @@ fn main() {
} }
}, },
Err(error) => { Err(error) => {
eprintln!("{}", error) println!("{}", error)
} }
} }
} }

View File

@ -1,8 +1,17 @@
pub mod types; pub mod types;
use tool_helper::{Error, Input}; use tool_helper::{Error, Input};
use std::io::BufRead;
use types::Section; use types::Section;
pub fn scan(input: Input) -> Result<Vec<Section>, Error> { pub fn scan(input: Input) -> Result<Vec<Section>, 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")) Err(Error::not_implemented("readmap::scan"))
} }

View File

@ -25,7 +25,7 @@ pub fn main() {
} }
}, },
Err(error) => { Err(error) => {
exit_with_error(Error::from_error(error)); println!("{}", error)
} }
} }
} }

View File

@ -1,6 +1,6 @@
use colored::*; use colored::*;
use envmnt::{ExpandOptions, ExpansionType}; 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 bits;
pub mod compress; pub mod compress;
@ -8,7 +8,7 @@ pub mod raw;
pub type BufferedInputFile = BufReader<std::fs::File>; pub type BufferedInputFile = BufReader<std::fs::File>;
pub type Output = Box<dyn Write>; pub type Output = Box<dyn Write>;
pub type Input = Box<dyn Read>; pub type Input = Box<dyn BufRead>;
#[macro_export] #[macro_export]
macro_rules! format_if_error { macro_rules! format_if_error {

View File

@ -13,7 +13,7 @@ fn main() {
print!("{}", wslpath::convert(cmd_line.path_string)); print!("{}", wslpath::convert(cmd_line.path_string));
}, },
Err(error) => { Err(error) => {
eprintln!("{}", error); println!("{}", error);
} }
} }
} }