added arg aliases and fixed #24

i18n
jan Michal 2 years ago
parent 8344148820
commit 5d1205e1de
No known key found for this signature in database
GPG Key ID: A6A1A4DCB22279B9

@ -18,23 +18,23 @@ pub struct Args {
#[derive(Debug, Clone, Subcommand)] #[derive(Debug, Clone, Subcommand)]
pub enum Operation { pub enum Operation {
/// Installs a package from either the AUR or the PacMan-defined repositories /// Installs a package from either the AUR or the PacMan-defined repositories
#[clap(name="install", aliases=&["i", "-S"])] #[clap(name="install", aliases=&["ins", "in", "i", "-S"])]
Install(InstallArgs), Install(InstallArgs),
/// Removes a previously installed package /// Removes a previously installed package
#[clap(name="remove", aliases=&["rm", "-R", "-Rs"])] #[clap(name="remove", aliases=&["rm", "r", "-R", "-Rs"])]
Remove(RemoveArgs), Remove(RemoveArgs),
/// Searches for the relevant packages in both the AUR and repos /// Searches for the relevant packages in both the AUR and repos
#[clap(name="search", aliases=&["sea", "-Ss"])] #[clap(name="search", aliases=&["sea", "se", "s", "-Ss"])]
Search(SearchArgs), Search(SearchArgs),
/// Queries installed packages /// Queries installed packages
#[clap(name="query", aliases=&["ls", "-Q"])] #[clap(name="query", aliases=&["ls", "l", "-Q"])]
Query(QueryArgs), Query(QueryArgs),
/// Upgrades locally installed packages to their latest versions /// Upgrades locally installed packages to their latest versions
#[clap(name="upgrade", aliases=&["upg", "-Syu"])] #[clap(name="upgrade", aliases=&["upg", "up", "u", "-Syu"])]
Upgrade, Upgrade,
} }

@ -1,5 +1,6 @@
use std::env; use std::env;
use std::path::Path; use std::path::Path;
use std::process::Command;
use crate::internal::strings::{crash, log}; use crate::internal::strings::{crash, log};
use crate::Options; use crate::Options;
@ -74,4 +75,53 @@ pub fn init(options: Options) {
} }
} }
} }
let r = Command::new("chmod")
.arg("-R")
.arg("770")
.arg(format!("{}/.cache/ame", homedir))
.status();
match r {
Ok(_) => {
if verbosity >= 1 {
log(format!(
"Set correct permissions for path: {}/.cache/ame",
homedir
));
}
}
Err(e) => {
crash(
format!(
"Couldn't set permissions for path: {}/.cache/ame: {}",
homedir, e
),
5,
);
}
};
let r = Command::new("chmod")
.arg("-R")
.arg("770")
.arg(format!("{}/.local/share/ame", homedir))
.status();
match r {
Ok(_) => {
if verbosity >= 1 {
log(format!(
"Set correct permissions for path: {}/.local/share/ame",
homedir
));
}
}
Err(e) => {
crash(
format!(
"Couldn't set permissions for path: {}/.local/share/ame: {}",
homedir, e
),
5,
);
}
};
} }

Loading…
Cancel
Save