Add List function

This commit is contained in:
2026-03-22 21:40:48 -05:00
parent 2f7cc9c150
commit 1dcd456cb2
4 changed files with 24 additions and 3 deletions

View File

@@ -47,6 +47,8 @@ enum Subcommand {
#[clap(subcommand)]
command: UtilSubcommand,
},
/// List available build modes
List,
}
#[derive(clap::Subcommand)]
@@ -143,10 +145,29 @@ impl App {
}
}
},
Subcommand::List => match list() {
Err(e) => {
eprintln!("Error listing build profiles: {e}");
std::process::exit(1);
}
_ => {}
},
}
}
}
fn list() -> std::io::Result<()> {
let conf = get_config().ok_or(std::io::Error::new(
std::io::ErrorKind::NotFound,
"no Pallet.toml found in local directory",
))?;
for build in conf.build {
println!(" - {}: {:?}", build.name.green().bold(), build.args);
}
Ok(())
}
fn create_project<P: AsRef<Path>>(directory: P) -> std::io::Result<()> {
let name = if directory.as_ref().to_string_lossy() == "." {
String::new()