Add List function
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -164,7 +164,7 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
|
||||
|
||||
[[package]]
|
||||
name = "pallet"
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"clap_complete",
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
2
PKGBUILD
2
PKGBUILD
@@ -1,6 +1,6 @@
|
||||
# Maintainer: Shea Frembling <sfrembling@gmail.com>
|
||||
pkgname=pallet
|
||||
pkgver=1.0.3
|
||||
pkgver=1.0.4
|
||||
pkgrel=1
|
||||
pkgdesc="A simple C project manager inspired by Cargo"
|
||||
arch=('x86_64')
|
||||
|
||||
21
src/app.rs
21
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<P: AsRef<Path>>(directory: P) -> std::io::Result<()> {
|
||||
let name = if directory.as_ref().to_string_lossy() == "." {
|
||||
String::new()
|
||||
|
||||
Reference in New Issue
Block a user