add showing group content (WIP)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
pub(crate) const CLEAN: &str = "clean";
|
||||
pub(crate) const EDIT: &str = "edit";
|
||||
pub(crate) const GROUPS: &str = "groups";
|
||||
pub(crate) const SHOW: &str = "show";
|
||||
pub(crate) const SYNC: &str = "sync";
|
||||
pub(crate) const UNMANAGED: &str = "unmanaged";
|
||||
pub(crate) const VERSION: &str = "version";
|
||||
|
||||
@@ -16,6 +16,12 @@ fn get_arg_parser() -> Command<'static> {
|
||||
.arg(Arg::new("group").multiple_values(true)),
|
||||
)
|
||||
.subcommand(Command::new(GROUPS).about("show names of imported groups"))
|
||||
.subcommand(
|
||||
Command::new(SHOW)
|
||||
.about("show packages under an imported group")
|
||||
.arg_required_else_help(true)
|
||||
.arg(Arg::new("group").multiple_values(true)),
|
||||
)
|
||||
.subcommand(Command::new(SYNC).about("install packages from all imported groups"))
|
||||
.subcommand(
|
||||
Command::new(UNMANAGED)
|
||||
|
||||
@@ -29,6 +29,7 @@ impl Pacdef {
|
||||
self.edit_group_files(groups).context("editing group files")
|
||||
}
|
||||
Some((action::GROUPS, _)) => Ok(self.show_groups()),
|
||||
Some((action::SHOW, _)) => Ok(self.show_packages_under_group()),
|
||||
Some((action::SYNC, _)) => Ok(self.install_packages()),
|
||||
Some((action::UNMANAGED, _)) => Ok(self.show_unmanaged_packages()),
|
||||
Some((action::VERSION, _)) => Ok(self.show_version()),
|
||||
@@ -167,6 +168,14 @@ impl Pacdef {
|
||||
backend.remove_packages(packages);
|
||||
}
|
||||
}
|
||||
|
||||
fn show_packages_under_group(&self) {
|
||||
let groups = self.args.get_many::<String>("group").unwrap();
|
||||
for arg_group in groups {
|
||||
let group = self.groups.iter().find(|g| g.name == *arg_group).unwrap();
|
||||
println!("{group}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn show_error(error: anyhow::Error, backend: Box<dyn Backend>) {
|
||||
|
||||
Reference in New Issue
Block a user