added feature request: list aur/repo packages installd (issue #11)

i18n
michal 2 years ago
parent 9e55999174
commit 7b79bcdfb3

@ -1,5 +1,5 @@
use std::io;
use std::process::exit;
use std::process::{exit, Command};
use clap::{App, AppSettings, Arg, ArgMatches, ArgSettings, Shell, SubCommand};
@ -89,6 +89,21 @@ fn main() {
.index(1),
),
)
.subcommand(
SubCommand::with_name("query")
.about("Queries installed packages")
.aliases(&["-Q", "ls"])
.arg(
Arg::with_name("aur")
.short("a")
.help("Lists AUR/foreign packages"),
)
.arg(
Arg::with_name("repo")
.short("r")
.help("Lists repo/native packages"),
),
)
.subcommand(
SubCommand::with_name("upgrade")
.about("Upgrades locally installed packages to their latest versions")
@ -209,6 +224,57 @@ fn main() {
}
exit(0);
}
if let true = matches.is_present("query") {
if matches
.subcommand_matches("query")
.unwrap()
.is_present("aur")
{
Command::new("pacman")
.arg("-Qm")
.spawn()
.expect("Something has gone wrong")
.wait()
.unwrap();
}
if matches
.subcommand_matches("query")
.unwrap()
.is_present("repo")
{
Command::new("pacman")
.arg("-Qn")
.spawn()
.expect("Something has gone wrong")
.wait()
.unwrap();
}
if !matches
.subcommand_matches("query")
.unwrap()
.is_present("aur")
&& !matches
.subcommand_matches("query")
.unwrap()
.is_present("repo")
{
Command::new("pacman")
.arg("-Qn")
.spawn()
.expect("Something has gone wrong")
.wait()
.unwrap();
Command::new("pacman")
.arg("-Qm")
.spawn()
.expect("Something has gone wrong")
.wait()
.unwrap();
}
exit(0);
}
if let true = &matches.is_present("compgen") {
let mut app = build_app();
match matches
@ -235,4 +301,4 @@ fn main() {
_ => {}
}
}
}
}
Loading…
Cancel
Save