Warn users about the dangers of `vimdiff`

i18n
Michal 2 years ago
parent d3600d52db
commit b6ef37cf6f

@ -1,7 +1,7 @@
use crate::internal::commands::ShellCommand;
use crate::internal::error::SilentUnwrap;
use crate::internal::exit_code::AppExitCode;
use crate::internal::strings::prompt;
use crate::internal::strings::{prompt, warn};
pub fn detect() {
let mut pacnew = vec![];
@ -16,12 +16,16 @@ pub fn detect() {
}
if !pacnew.is_empty() {
let choice = prompt("It appears that at least one program you have installed / upgraded has installed a .pacnew/.pacsave config file. Would you like to run pacdiff to deal with this?".to_string(), true);
let choice = prompt("It appears that at least one program you have installed / upgraded has installed a .pacnew/.pacsave config file. Would you like to run pacdiff to deal with this? You can always deal with this later by running `sudo pacdiff`".to_string(), false);
if choice {
ShellCommand::pacdiff()
.elevated()
.wait()
.silent_unwrap(AppExitCode::PacmanError);
warn("Unless you've set an alternative using the DIFFPROG environment variable, pacdiff uses `vimdiff` by default to edit files for merging. Make sure you know how to exit vim before proceeding".to_string());
let cont = prompt("Continue?".to_string(), false);
if cont {
ShellCommand::pacdiff()
.elevated()
.wait()
.silent_unwrap(AppExitCode::PacmanError);
}
}
}
}

@ -13,7 +13,6 @@ pub fn info<S: ToString>(msg: S) {
println!("\x1b[2;22;35m❖\x1b[0m \x1b[1;37m{}\x1b[0m", a)
}
#[allow(dead_code)]
pub fn warn<S: ToString>(msg: S) {
let a = msg.to_string();
let a = if internal::uwu_enabled() { uwu!(&a) } else { a };

@ -6,8 +6,7 @@ use internal::error::SilentUnwrap;
use crate::args::{InstallArgs, Operation, QueryArgs, RemoveArgs, SearchArgs};
use crate::internal::detect;
use crate::internal::exit_code::AppExitCode;
#[allow(unused_imports)]
use crate::internal::{crash, info, init, log, prompt, sort, structs::Options, warn};
use crate::internal::{crash, info, init, log, prompt, sort, structs::Options};
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

Loading…
Cancel
Save