Extend batch file to use run commands
This commit is contained in:
parent
927d67fc5b
commit
74253e40e3
|
@ -22,6 +22,11 @@
|
|||
"command": "./run_cargo ${input:project} ${input:cargo cmd} ${input:build cfg} ${input:cargo target}",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
},
|
||||
"options": {
|
||||
"env": {
|
||||
"CARGO_RUN_ARGS": "${input:cargo run args}"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -69,6 +74,13 @@
|
|||
"type": "pickString",
|
||||
"options": ["windows", "linux"],
|
||||
"description": "The target for the tool to build"
|
||||
},
|
||||
{
|
||||
"id": "cargo run args",
|
||||
"type": "pickString",
|
||||
"options": ["", "--help"],
|
||||
"default": "",
|
||||
"description": "Argument options to pass to cargo run"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use clap::{Parser, Subcommand};
|
||||
use clap::{Parser, ValueEnum};
|
||||
use psxcdgen_ex::{encoder::psx::{encode_psx_image, calculate_psx_lbas}, file_writer::{ImageType, write_image}, types::{layout::Layout}, config_reader};
|
||||
use std::{path::PathBuf, str::FromStr};
|
||||
use tool_helper::Error;
|
||||
|
@ -6,7 +6,27 @@ use tool_helper::Error;
|
|||
#[derive(Parser)]
|
||||
#[clap(about = "Creates an ISO image from a description file", long_about = None)]
|
||||
struct CommandLine {
|
||||
#[clap(value_enum, value_parser)]
|
||||
system_type: SystemType,
|
||||
|
||||
#[clap(value_enum, value_parser, default_value_t=OutputType::BinCue)]
|
||||
output_type: OutputType,
|
||||
|
||||
#[clap(short='o')]
|
||||
output_file: PathBuf,
|
||||
|
||||
#[clap(value_parser)]
|
||||
input_file: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
||||
enum SystemType {
|
||||
Psx
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
||||
enum OutputType {
|
||||
BinCue
|
||||
}
|
||||
|
||||
fn run_main() -> Result<(), Error> {
|
||||
|
|
|
@ -11,6 +11,8 @@ IF %4 == linux (
|
|||
set target=x86_64-unknown-linux-musl
|
||||
)
|
||||
|
||||
IF defined CARGO_RUN_ARGS set run_args=-- %CARGO_RUN_ARGS%
|
||||
|
||||
IF %2 == build set run_build=1
|
||||
IF %2 == test set run_build=1
|
||||
|
||||
|
@ -28,7 +30,7 @@ IF defined run_build (
|
|||
|
||||
IF %2 == run (
|
||||
echo cargo run %1 --%3
|
||||
cargo run --%3 --target=%target%
|
||||
cargo run --%3 --target=%target% %run_args%
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue