feat: multi-package install and bakery update all
Some checks failed
release / build (push) Failing after 32s

- bakery install now accepts one or more package names
- bakery update all treated as update-everything (same as bare update)
- bump version to 0.2.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Breadway 2026-06-07 14:51:20 +08:00
parent 5edb5bae31
commit b97882e715
3 changed files with 14 additions and 7 deletions

View file

@ -20,9 +20,10 @@ struct Cli {
#[derive(Subcommand)]
enum Cmd {
/// Install a package
/// Install one or more packages
Install {
package: String,
#[arg(required = true, num_args = 1..)]
packages: Vec<String>,
},
/// Remove an installed package (data files are never deleted)
Remove {
@ -61,7 +62,12 @@ fn main() -> Result<()> {
let bin_dir = cli.bin_dir.unwrap_or_else(default_bin_dir);
match cli.command {
Cmd::Install { package } => cmd_install(&package, &bin_dir),
Cmd::Install { packages } => {
for pkg in &packages {
cmd_install(pkg, &bin_dir)?;
}
Ok(())
}
Cmd::Remove { package } => cmd_remove(&package, &bin_dir),
Cmd::Update { package } => cmd_update(package.as_deref(), &bin_dir),
Cmd::List { installed } => cmd_list(installed),
@ -96,7 +102,8 @@ fn cmd_update(name: Option<&str>, bin_dir: &std::path::Path) -> Result<()> {
let index = manifest::load(true)?; // force refresh on update
let state = state::State::load()?;
let targets: Vec<String> = match name {
let effective = name.filter(|&n| n != "all");
let targets: Vec<String> = match effective {
Some(n) => vec![n.to_string()],
None => state.packages.keys().cloned().collect(),
};