|
|
@ -31,7 +31,7 @@ use logging::init_logger;
|
|
|
|
async fn main() {
|
|
|
|
async fn main() {
|
|
|
|
color_eyre::install().unwrap();
|
|
|
|
color_eyre::install().unwrap();
|
|
|
|
if unsafe { libc::geteuid() } == 0 {
|
|
|
|
if unsafe { libc::geteuid() } == 0 {
|
|
|
|
crash!(AppExitCode::RunAsRoot, "{}", fl!("run-as-root"));
|
|
|
|
fl_crash!(AppExitCode::RunAsRoot, "run-as-root");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let args: Args = Args::parse();
|
|
|
|
let args: Args = Args::parse();
|
|
|
@ -64,11 +64,11 @@ async fn main() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Operation::Query(query_args) => cmd_query(query_args).await,
|
|
|
|
Operation::Query(query_args) => cmd_query(query_args).await,
|
|
|
|
Operation::Upgrade(upgrade_args) => {
|
|
|
|
Operation::Upgrade(upgrade_args) => {
|
|
|
|
tracing::info!("{}", fl!("system-upgrade"));
|
|
|
|
fl_info!("system-upgrade");
|
|
|
|
operations::upgrade(upgrade_args, options).await;
|
|
|
|
operations::upgrade(upgrade_args, options).await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Operation::Clean => {
|
|
|
|
Operation::Clean => {
|
|
|
|
tracing::info!("{}", fl!("removing-orphans"));
|
|
|
|
fl_info!("removing-orphans");
|
|
|
|
operations::clean(options).await;
|
|
|
|
operations::clean(options).await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Operation::GenComp(gen_args) => cmd_gencomp(&gen_args),
|
|
|
|
Operation::GenComp(gen_args) => cmd_gencomp(&gen_args),
|
|
|
@ -100,10 +100,10 @@ async fn cmd_install(args: InstallArgs, options: Options) {
|
|
|
|
if both {
|
|
|
|
if both {
|
|
|
|
let sorted = sort(packages, options).await;
|
|
|
|
let sorted = sort(packages, options).await;
|
|
|
|
if !sorted.nf.is_empty() {
|
|
|
|
if !sorted.nf.is_empty() {
|
|
|
|
crash!(
|
|
|
|
fl_crash!(
|
|
|
|
AppExitCode::PacmanError,
|
|
|
|
AppExitCode::PacmanError,
|
|
|
|
"{}",
|
|
|
|
"couldnt-find-packages",
|
|
|
|
fl!("couldnt-find-packages", packages = sorted.nf.join(", "))
|
|
|
|
packages = sorted.nf.join(", ")
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !sorted.repo.is_empty() {
|
|
|
|
if !sorted.repo.is_empty() {
|
|
|
@ -111,13 +111,14 @@ async fn cmd_install(args: InstallArgs, options: Options) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !sorted.aur.is_empty() {
|
|
|
|
if !sorted.aur.is_empty() {
|
|
|
|
if Config::read().base.aur_verification_prompt {
|
|
|
|
if Config::read().base.aur_verification_prompt {
|
|
|
|
tracing::info!("{}", fl!("following-packages"));
|
|
|
|
fl_info!("following-packages");
|
|
|
|
get_logger().print_list(&sorted.aur, " ", 2);
|
|
|
|
get_logger().print_list(&sorted.aur, " ", 2);
|
|
|
|
newline!();
|
|
|
|
newline!();
|
|
|
|
tracing::warn!("{}", fl!("aur-warning"));
|
|
|
|
fl_warn!("aur-warning");
|
|
|
|
let cont = noconfirm || prompt!(default no, "{}", fl!("are-you-sure"));
|
|
|
|
let cont = noconfirm || fl_prompt!(default no, "are-you-sure");
|
|
|
|
|
|
|
|
|
|
|
|
if !cont {
|
|
|
|
if !cont {
|
|
|
|
tracing::info!("{}", fl!("exiting"));
|
|
|
|
fl_info!("exiting");
|
|
|
|
std::process::exit(AppExitCode::PacmanError as i32);
|
|
|
|
std::process::exit(AppExitCode::PacmanError as i32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -131,10 +132,7 @@ async fn cmd_install(args: InstallArgs, options: Options) {
|
|
|
|
#[tracing::instrument(level = "trace")]
|
|
|
|
#[tracing::instrument(level = "trace")]
|
|
|
|
async fn cmd_remove(args: RemoveArgs, options: Options) {
|
|
|
|
async fn cmd_remove(args: RemoveArgs, options: Options) {
|
|
|
|
let packages = args.packages;
|
|
|
|
let packages = args.packages;
|
|
|
|
tracing::info!(
|
|
|
|
fl_info!("uninstalling-packages", packages = packages.join(", "));
|
|
|
|
"{}",
|
|
|
|
|
|
|
|
fl!("uninstalling-packages", packages = packages.join(", "))
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
operations::uninstall(packages, options).await;
|
|
|
|
operations::uninstall(packages, options).await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -146,20 +144,20 @@ async fn cmd_search(args: InstallArgs, options: Options) {
|
|
|
|
let mut results = Vec::new();
|
|
|
|
let mut results = Vec::new();
|
|
|
|
|
|
|
|
|
|
|
|
if args.repo || both {
|
|
|
|
if args.repo || both {
|
|
|
|
tracing::info!("{}", fl!("searching-repos", query = query_string.clone()));
|
|
|
|
fl_info!("searching-repos", query = query_string.clone());
|
|
|
|
let res = operations::search(&query_string, options).await;
|
|
|
|
let res = operations::search(&query_string, options).await;
|
|
|
|
results.extend(res);
|
|
|
|
results.extend(res);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if args.aur || both {
|
|
|
|
if args.aur || both {
|
|
|
|
tracing::info!("{}", fl!("searching-aur", query = query_string.clone()));
|
|
|
|
fl_info!("searching-aur", query = query_string.clone());
|
|
|
|
let res = operations::aur_search(&query_string, args.by, options).await;
|
|
|
|
let res = operations::aur_search(&query_string, args.by, options).await;
|
|
|
|
results.extend(res);
|
|
|
|
results.extend(res);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if results.is_empty() {
|
|
|
|
if results.is_empty() {
|
|
|
|
tracing::info!("{}", fl!("no-results"));
|
|
|
|
fl_info!("no-results");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
tracing::info!("{}", fl!("results"));
|
|
|
|
fl_info!("results");
|
|
|
|
|
|
|
|
|
|
|
|
results.sort_by(|a, b| {
|
|
|
|
results.sort_by(|a, b| {
|
|
|
|
let a_score = a.score(&query_string);
|
|
|
|
let a_score = a.score(&query_string);
|
|
|
@ -184,7 +182,7 @@ async fn cmd_query(args: QueryArgs) {
|
|
|
|
let both = !args.aur && !args.repo && args.info.is_none();
|
|
|
|
let both = !args.aur && !args.repo && args.info.is_none();
|
|
|
|
|
|
|
|
|
|
|
|
if args.repo {
|
|
|
|
if args.repo {
|
|
|
|
tracing::info!("{}", fl!("installed-repo-packages"));
|
|
|
|
fl_info!("installed-repo-packages");
|
|
|
|
PacmanQueryBuilder::native()
|
|
|
|
PacmanQueryBuilder::native()
|
|
|
|
.color(PacmanColor::Always)
|
|
|
|
.color(PacmanColor::Always)
|
|
|
|
.query()
|
|
|
|
.query()
|
|
|
@ -193,7 +191,7 @@ async fn cmd_query(args: QueryArgs) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if args.aur {
|
|
|
|
if args.aur {
|
|
|
|
tracing::info!("{}", fl!("installed-aur-packages"));
|
|
|
|
fl_info!("installed-aur-packages");
|
|
|
|
PacmanQueryBuilder::foreign()
|
|
|
|
PacmanQueryBuilder::foreign()
|
|
|
|
.color(PacmanColor::Always)
|
|
|
|
.color(PacmanColor::Always)
|
|
|
|
.query()
|
|
|
|
.query()
|
|
|
@ -202,7 +200,7 @@ async fn cmd_query(args: QueryArgs) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if both {
|
|
|
|
if both {
|
|
|
|
tracing::info!("{}", fl!("installed-packages"));
|
|
|
|
fl_info!("installed-packages");
|
|
|
|
PacmanQueryBuilder::all()
|
|
|
|
PacmanQueryBuilder::all()
|
|
|
|
.color(PacmanColor::Always)
|
|
|
|
.color(PacmanColor::Always)
|
|
|
|
.query()
|
|
|
|
.query()
|
|
|
@ -230,11 +228,11 @@ fn cmd_gencomp(args: &GenCompArgs) {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
let shell: Shell = Shell::from_str(&args.shell).unwrap_or_else(|e| {
|
|
|
|
let shell: Shell = Shell::from_str(&args.shell).unwrap_or_else(|e| {
|
|
|
|
crash!(AppExitCode::Other, "{}", fl!("invalid-shell", shell = e));
|
|
|
|
fl_crash!(AppExitCode::Other, "invalid-shell", shell = e);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if shell == Shell::Zsh {
|
|
|
|
if shell == Shell::Zsh {
|
|
|
|
crash!(AppExitCode::Other, "{}", fl!("zsh-error"));
|
|
|
|
fl_crash!(AppExitCode::Other, "zsh-error");
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
clap_complete::generate(
|
|
|
|
clap_complete::generate(
|
|
|
|