CLI cleanup
All checks were successful
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good
All checks were successful
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good
This commit is contained in:
parent
6ed3f24b1c
commit
401a56a4c6
@ -33,25 +33,6 @@ enum Commands {
|
||||
#[arg(long, default_value_t = 7777)]
|
||||
port: u16,
|
||||
},
|
||||
/// Compiles a source project into a cartridge directory with `program.pbx`.
|
||||
Build {
|
||||
/// Project source directory.
|
||||
project_dir: String,
|
||||
|
||||
/// Whether to explain the dependency resolution process.
|
||||
#[arg(long)]
|
||||
explain_deps: bool,
|
||||
},
|
||||
/// Packages a cartridge directory into a distributable .pmc file.
|
||||
Pack {
|
||||
/// Cartridge directory.
|
||||
cart_dir: String,
|
||||
},
|
||||
/// Diagnostic commands to verify project or cartridge integrity.
|
||||
Verify {
|
||||
#[command(subcommand)]
|
||||
target: VerifyCommands,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
@ -94,26 +75,6 @@ fn main() {
|
||||
&["--debug", &cart, "--port", &port.to_string()],
|
||||
);
|
||||
}
|
||||
Some(Commands::Build { project_dir, explain_deps }) => {
|
||||
let mut args = vec!["build", &project_dir];
|
||||
if explain_deps {
|
||||
args.push("--explain-deps");
|
||||
}
|
||||
dispatch(&exe_dir, "prometeuc", &args);
|
||||
}
|
||||
Some(Commands::Pack { .. }) => {
|
||||
not_implemented("pack", "prometeup");
|
||||
}
|
||||
Some(Commands::Verify { target }) => match target {
|
||||
VerifyCommands::C { project_dir, explain_deps } => {
|
||||
let mut args = vec!["verify", &project_dir];
|
||||
if explain_deps {
|
||||
args.push("--explain-deps");
|
||||
}
|
||||
dispatch(&exe_dir, "prometeuc", &args);
|
||||
}
|
||||
VerifyCommands::P { .. } => not_implemented("verify p", "prometeup"),
|
||||
},
|
||||
None => {
|
||||
use clap::CommandFactory;
|
||||
Cli::command().print_help().unwrap();
|
||||
@ -172,11 +133,6 @@ fn execute_bin(bin_path: &Path, args: &[&str]) {
|
||||
}
|
||||
}
|
||||
|
||||
fn not_implemented(cmd: &str, _bin_name: &str) {
|
||||
eprintln!("prometeu: command '{}' is not yet available in this distribution", cmd);
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
fn child_exit_code(status: ExitStatus) -> Result<i32, &'static str> {
|
||||
status.code().ok_or("child process terminated without a numeric exit code")
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user