Fixed Cargo.toml & flake.nix, solved issue #6, added new warn(); helper function.

i18n
Michal 2 years ago
parent a82319cd3f
commit f1f41a86e0

@ -0,0 +1 @@
use flake

1
.gitignore vendored

@ -5,3 +5,4 @@ ame.exe
.idea
result
.DS_Store
.direnv

@ -5,6 +5,7 @@ authors = ["michal <michal@tar.black>", "axtlos <axtlos@tar.black>"]
edition = "2021"
description = "A fast and efficient AUR helper"
license-file = "LICENSE.md"
default-run = "ame"
[features]
pkg-warner = []

@ -22,7 +22,7 @@
];
};
defaultPackage = packages.amethyst;
packages.default = packages.amethyst;
apps.amethyst = utils.lib.mkApp {
drv = packages.amethyst;
@ -30,7 +30,7 @@
apps.default = apps.amethyst;
devShell = pkgs.mkShell {
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rustc
cargo

@ -13,6 +13,14 @@ 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 };
println!("\x1b[2;22;33m!\x1b[0m \x1b[1;37m{}\x1b[0m", a)
}
pub fn crash<S: ToString>(msg: S, exit_code: AppExitCode) -> ! {
let a = msg.to_string();
let a = if internal::uwu_enabled() { uwu!(&a) } else { a };

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

@ -3,7 +3,7 @@ use crate::internal::error::SilentUnwrap;
use crate::internal::exit_code::AppExitCode;
use crate::internal::rpc::rpcinfo;
use crate::operations::aur_install::aur_install;
use crate::{info, log, Options};
use crate::{info, log, prompt, Options};
pub fn upgrade(options: Options) {
let verbosity = options.verbosity;
@ -18,12 +18,23 @@ pub fn upgrade(options: Options) {
log("Upgrading repo packages".to_string());
}
ShellCommand::pacman()
let pacman_result = ShellCommand::pacman()
.elevated()
.args(pacman_args)
.wait_success()
.wait()
.silent_unwrap(AppExitCode::PacmanError);
if pacman_result.success() {
info("Successfully upgraded repo packages".to_string());
} else {
let cont = prompt("Failed to upgrade repo packages, continue to upgrading AUR packages?".to_string(), false);
if !cont {
info("Exiting".to_string());
std::process::exit(AppExitCode::PacmanError as i32);
}
}
if verbosity >= 1 {
log("Upgrading AUR packages".to_string());
}

Loading…
Cancel
Save