Add colored output to most tools; Make mkoverlay more tolerant for missing overlay files; Make psxcdgen_ex emit a warning when no license file is specified
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "mkoverlay"
|
||||
version = "1.1.0"
|
||||
version = "1.1.1"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
@@ -1,6 +1,7 @@
|
||||
use clap::Parser;
|
||||
use tool_helper::{Error, format_if_error, open_input, open_output};
|
||||
use mkoverlay::types::OverlayDesc;
|
||||
use std::path::PathBuf;
|
||||
use tool_helper::{Error, exit_with_error, format_if_error, open_input, open_output};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[clap(about = "Creates a linker script and makefile part for the JabyEngine toolchain", long_about = None)]
|
||||
@@ -12,12 +13,22 @@ struct CommandLine {
|
||||
ld_file_output: Option<PathBuf>,
|
||||
|
||||
#[clap(value_parser, help="Input JSON for creating the files")]
|
||||
input: PathBuf
|
||||
input: Option<PathBuf>
|
||||
}
|
||||
|
||||
fn parse_input(input: Option<PathBuf>) -> Result<OverlayDesc, Error> {
|
||||
if let Some(input) = input {
|
||||
let input = format_if_error!(open_input(Some(input)), "Opening input file failed with: {error_text}")?;
|
||||
format_if_error!(mkoverlay::types::json_reader::read_config(input), "Parsing JSON file failed with: {error_text}")
|
||||
}
|
||||
|
||||
else {
|
||||
Ok(OverlayDesc::new())
|
||||
}
|
||||
}
|
||||
|
||||
fn run_main(cmd_line: CommandLine) -> Result<(), Error> {
|
||||
let input = format_if_error!(open_input(Some(cmd_line.input)), "Opening input file failed with: {error_text}")?;
|
||||
let input = format_if_error!(mkoverlay::types::json_reader::read_config(input), "Parsing JSON file failed with: {error_text}")?;
|
||||
let input = parse_input(cmd_line.input)?;
|
||||
let mut mk_output = format_if_error!(open_output(cmd_line.mk_file_output), "Opening file for writing makefile failed with: {error_text}")?;
|
||||
let mut ld_output = format_if_error!(open_output(cmd_line.ld_file_output), "Opening file for writing linkerfile failed with: {error_text}")?;
|
||||
|
||||
@@ -30,11 +41,11 @@ fn main() {
|
||||
Ok(cmd_line) => {
|
||||
match run_main(cmd_line) {
|
||||
Ok(_) => (),
|
||||
Err(error) => eprintln!("{}", error)
|
||||
Err(error) => exit_with_error(error)
|
||||
}
|
||||
},
|
||||
Err(error) => {
|
||||
eprintln!("{}", error);
|
||||
exit_with_error(Error::from_error(error));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user