diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 4b75929..fbc5213 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -23,17 +23,6 @@ impl Backends { pub fn iter() -> BackendIter { BackendIter(Some(Self::Pacman)) } - - fn get(&self) -> Box { - match self { - Self::Pacman => Box::new(Pacman { - packages: HashSet::new(), - }), - Self::Rust => Box::new(Rust { - packages: HashSet::new(), - }), - } - } } #[derive(Debug)] diff --git a/src/cmd.rs b/src/cmd.rs index 036d0fd..a829bba 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -1,12 +1,12 @@ use std::path::PathBuf; use std::process::{Command, ExitStatus}; -use anyhow::{anyhow, Result}; +use anyhow::{anyhow, Context, Result}; use crate::env::get_editor; pub fn run_edit_command(files: &[PathBuf]) -> Result { - let mut cmd = Command::new(get_editor()?); + let mut cmd = Command::new(get_editor().context("getting suitable editor")?); cmd.current_dir(files[0].parent().unwrap()); for f in files { cmd.arg(f.to_string_lossy().to_string()); diff --git a/src/group.rs b/src/group.rs index 441f52a..b748eab 100644 --- a/src/group.rs +++ b/src/group.rs @@ -9,8 +9,8 @@ use crate::section::Section; #[derive(Debug)] pub struct Group { - pub name: String, - pub sections: HashSet
, + pub(crate) name: String, + pub(crate) sections: HashSet
, } impl Group { diff --git a/src/lib.rs b/src/lib.rs index e37a288..a527e06 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ mod action; pub mod args; -pub mod backend; +mod backend; mod cmd; mod core; mod env; diff --git a/src/package.rs b/src/package.rs index b24927d..5915c07 100644 --- a/src/package.rs +++ b/src/package.rs @@ -1,10 +1,9 @@ -use std::collections::HashSet; use std::fmt::{Display, Write}; use std::hash::Hash; #[derive(Debug, Eq, PartialOrd, Ord, Clone)] pub struct Package { - pub name: String, + pub(crate) name: String, repo: Option, } @@ -16,15 +15,6 @@ fn remove_all_but_package_name(s: &str) -> &str { } impl Package { - pub(crate) fn from_lines( - lines: impl Iterator>, - ) -> HashSet { - lines - .into_iter() - .filter_map(|l| Package::try_from(l.unwrap())) - .collect() - } - fn split_into_name_and_repo(s: &str) -> (String, Option) { let mut iter = s.split('/').rev(); let name = iter.next().unwrap().to_string(); diff --git a/src/path.rs b/src/path.rs index d155928..b01eb0b 100644 --- a/src/path.rs +++ b/src/path.rs @@ -8,12 +8,6 @@ pub(crate) fn get_pacdef_group_dir() -> Result { Ok(result) } -pub(crate) fn get_pacdef_config_file() -> Result { - let mut result = get_pacdef_base_dir().context("getting pacdef base dir")?; - result.push("pacdef.conf"); - Ok(result) -} - fn get_pacdef_base_dir() -> Result { let mut dir = get_xdg_config_home().context("getting XDG_CONFIG_HOME")?; dir.push("pacdef");