Repository: sxyazi/yazi
File: yazi-cli/src/main.rs (Rust)

Code before:
		}

		Command::Pkg(cmd) => {
			package::init()?;

			let mut pkg = package::Package::load().await?;
			match cmd {
				CommandPkg::Add { ids } => pkg.add_many(&ids).await?,
				CommandPkg::Delete { ids } => pkg.delete_many(&ids).await?,
				CommandPkg::Install => pkg.install(false).await?,
				CommandPkg::List => pkg.print()?,
				CommandPkg::Upgrade => pkg.install(true).await?,
			}
		}

		Command::Pack(cmd) => {
			package::init()?;
			outln!(
				"WARNING: `ya pack` is deprecated, use the new `ya pkg` instead. See https://github.com/sxyazi/yazi/pull/2770 for more details."
			)?;
			if cmd.install {
				package::Package::load().await?.install(false).await?;
			} else if cmd.list {
				package::Package::load().await?.print()?;
			} else if cmd.upgrade {
				package::Package::load().await?.install(true).await?;
			} else if let Some(uses) = cmd.add {
				package::Package::load().await?.add_many(&uses).await?;
			} else if let Some(uses) = cmd.delete {
				package::Package::load().await?.delete_many(&uses).await?;
			}
		}

		Command::Pub(cmd) => {
			yazi_boot::init_default();
			yazi_dds::init();
			if let Err(e) = yazi_dds::Client::shot(&cmd.kind, CommandPub::receiver()?, &cmd.body()?).await
			{
				errln!("Cannot send message: {e}")?;
				std::process::exit(1);
			}
		}

		Command::PubTo(cmd) => {
			yazi_boot::init_default();
			yazi_dds::init();
			if let Err(e) = yazi_dds::Client::shot(&cmd.kind, cmd.receiver, &cmd.body()?).await {
				errln!("Cannot send message: {e}")?;
				std::process::exit(1);
			}
		}

Review comment (suggestion):
Using `upgrade_many(&[])` means no packages will be upgraded; for the deprecated `ya pack` upgrade path, consider calling the original `install` or iterating over all packages instead.
```suggestion
				package::Package::load().await?.install().await?;
```

Code after:
		}

		Command::Pkg(cmd) => {
			package::init()?;

			let mut pkg = package::Package::load().await?;
			match cmd {
				CommandPkg::Add { ids } => pkg.add_many(&ids).await?,
				CommandPkg::Delete { ids } => pkg.delete_many(&ids).await?,
				CommandPkg::Install => pkg.install().await?,
				CommandPkg::List => pkg.print()?,
				CommandPkg::Upgrade { ids } => pkg.upgrade_many(&ids).await?,
			}
		}

		Command::Pack(cmd) => {
			package::init()?;
			outln!(
				"WARNING: `ya pack` is deprecated, use the new `ya pkg` instead. See https://github.com/sxyazi/yazi/pull/2770 for more details."
			)?;
			if cmd.install {
				package::Package::load().await?.install().await?;
			} else if cmd.list {
				package::Package::load().await?.print()?;
			} else if cmd.upgrade {
				package::Package::load().await?.upgrade_many(&[]).await?;
			} else if let Some(uses) = cmd.add {
				package::Package::load().await?.add_many(&uses).await?;
			} else if let Some(uses) = cmd.delete {
				package::Package::load().await?.delete_many(&uses).await?;
			}
		}

		Command::Pub(cmd) => {
			yazi_boot::init_default();
			yazi_dds::init();
			if let Err(e) = yazi_dds::Client::shot(&cmd.kind, CommandPub::receiver()?, &cmd.body()?).await
			{
				errln!("Cannot send message: {e}")?;
				std::process::exit(1);
			}
		}

		Command::PubTo(cmd) => {
			yazi_boot::init_default();
			yazi_dds::init();
			if let Err(e) = yazi_dds::Client::shot(&cmd.kind, cmd.receiver, &cmd.body()?).await {
				errln!("Cannot send message: {e}")?;
				std::process::exit(1);
			}
		}