Обновление README.md, исходников, пакетки
This commit is contained in:
@ -1,29 +1,43 @@
|
||||
use crate::commands;
|
||||
use crate::utils::parser::pkginfo;
|
||||
|
||||
|
||||
pub fn link(matches: &clap::ArgMatches) {
|
||||
let repo = matches.get_one::<String>("repo").unwrap();
|
||||
let pkgname = matches.get_one::<String>("pkgname").unwrap();
|
||||
let pkg_names: Vec<&str> = matches
|
||||
.get_many::<String>("pkgname")
|
||||
.expect("At least one package name is required")
|
||||
.map(|s| s.as_str())
|
||||
.collect();
|
||||
|
||||
match commands::link::link(&repo, &pkgname) {
|
||||
Ok(_) => println!("link completed successfully."),
|
||||
Err(e) => eprintln!("Error during link: {}", e),
|
||||
let repo = matches.get_one::<String>("repo").map(|s| s.as_str());
|
||||
|
||||
for pkgname in pkg_names {
|
||||
let resolved_repo = if let Some(explicit_repo) = repo {
|
||||
&explicit_repo.to_string()
|
||||
} else {
|
||||
&pkginfo::get_priority_repo_installed(&pkgname.to_string())
|
||||
};
|
||||
|
||||
commands::link::link(resolved_repo, &pkgname.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn command() -> clap::Command {
|
||||
clap::Command::new("link")
|
||||
.about("Create package links and mount overlays")
|
||||
.arg(
|
||||
clap::Arg::new("repo")
|
||||
.help("Repository name")
|
||||
.required(true)
|
||||
.index(1),
|
||||
)
|
||||
.arg(
|
||||
clap::Arg::new("pkgname")
|
||||
.help("Package name")
|
||||
.required(true)
|
||||
.index(2),
|
||||
)
|
||||
.about("Create package links and mount overlays")
|
||||
.arg(
|
||||
clap::Arg::new("repo")
|
||||
.long("repo")
|
||||
.short('r')
|
||||
.help("Specify the repository to install the package(s) from (applies to all packages)")
|
||||
.value_name("REPO")
|
||||
.num_args(1)
|
||||
)
|
||||
.arg(
|
||||
clap::Arg::new("pkgname")
|
||||
.help("Name(s) of the package(s) to install")
|
||||
.required(true)
|
||||
.value_name("PKGNAME")
|
||||
.action(clap::ArgAction::Append)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user