diff --git a/src/action_list.rs b/src/action_list.rs new file mode 100644 index 0000000..fc4838c --- /dev/null +++ b/src/action_list.rs @@ -0,0 +1,15 @@ +use crate::alpm_wrapper::new_alpm_wrapper; + +pub fn list_real() { + let alpm = new_alpm_wrapper(); + let packages = match alpm.get_non_pacman_packages() { + Ok(packages) => packages, + Err(err) => { + eprintln!("Error: {}", err); + return; + } + }; + for (name, version) in packages.iter() { + println!("{} {}", name, version); + } +} diff --git a/src/cli_args.rs b/src/cli_args.rs index 8dccbbd..9bf113e 100644 --- a/src/cli_args.rs +++ b/src/cli_args.rs @@ -100,6 +100,8 @@ Sources are downloaded using .SRCINFO only" #[structopt(help = "Archive to check", required = true)] target: PathBuf, }, + #[structopt(about = "List packages installed with rua")] + List, #[structopt( about = "Upgrade AUR packages. To ignore packages, add them to IgnorePkg in /etc/pacman.conf" )] diff --git a/src/main.rs b/src/main.rs index 585d9da..92116f1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ mod action_builddir; mod action_install; +mod action_list; mod action_search; mod action_upgrade; mod alpm_wrapper; @@ -66,6 +67,9 @@ fn main() { ); eprintln!("Finished checking package: {:?}", target); } + Action::List => { + action_list::list_real(); + } Action::Upgrade { devel, printonly,