diff --git a/Cargo.lock b/Cargo.lock index 7436b9d..1c6fcc8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -164,7 +164,7 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "pallet" -version = "1.0.3" +version = "1.0.4" dependencies = [ "clap", "clap_complete", diff --git a/Cargo.toml b/Cargo.toml index b098efb..d23dd43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet" -version = "1.0.3" +version = "1.0.4" edition = "2024" description = "A project manager and build system for C inspired by Rust's Cargo" diff --git a/PKGBUILD b/PKGBUILD index dfa8517..3731d1d 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Shea Frembling pkgname=pallet -pkgver=1.0.3 +pkgver=1.0.4 pkgrel=1 pkgdesc="A simple C project manager inspired by Cargo" arch=('x86_64') diff --git a/src/app.rs b/src/app.rs index 61d8391..956b38b 100644 --- a/src/app.rs +++ b/src/app.rs @@ -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>(directory: P) -> std::io::Result<()> { let name = if directory.as_ref().to_string_lossy() == "." { String::new()