add missing docs

This commit is contained in:
steven-omaha
2023-02-14 15:01:01 +01:00
parent d982149595
commit c490c660b4
10 changed files with 88 additions and 29 deletions
+12
View File
@@ -2,6 +2,10 @@ use std::{env, path::PathBuf};
use anyhow::{Context, Result};
const CONFIG_FILE_NAME: &str = "pacdef.yaml";
/// Get the group directory where all group files are located. This is
/// `$XDG_CONFIG_HOME/pacdef/groups`, which defaults to `$HOME/.config/pacdef/groups`.
pub fn get_pacdef_group_dir() -> Result<PathBuf> {
let mut result = get_pacdef_base_dir().context("getting pacdef base dir")?;
result.push("groups");
@@ -27,3 +31,11 @@ fn get_xdg_config_home() -> Result<PathBuf> {
pub fn get_home_dir() -> Result<PathBuf> {
Ok(env::var("HOME").context("getting $HOME variable")?.into())
}
/// Get the group directory where all group files are located. This is
/// `$XDG_CONFIG_HOME/pacdef/pacdef.yaml`.
pub fn get_config_path() -> Result<PathBuf> {
let mut file = get_pacdef_base_dir().context("getting pacdef base dir for config file")?;
file.push(CONFIG_FILE_NAME);
Ok(file)
}