use crateAuthor;
use crate::;
use HashMap;
use File;
use ;
use ;
use ;
// pub fn global_config_dir() -> Option<PathBuf> {
// if let Ok(path) = std::env::var("PIJUL_CONFIG_DIR") {
// let dir = std::path::PathBuf::from(path);
// Some(dir)
// } else if let Some(mut dir) = dirs_next::config_dir() {
// dir.push(CONFIG_DIR);
// Some(dir)
// } else {
// None
// }
// }
// impl Global {
// pub fn load() -> Result<(Global, Option<u64>), anyhow::Error> {
// let res = None
// .or_else(|| {
// let mut path = global_config_dir()?;
// path.push("config.toml");
// try_load_file(path)
// })
// .or_else(|| {
// // Read from `$HOME/.config/pijul` dir
// let mut path = dirs_next::home_dir()?;
// path.push(".config");
// path.push(CONFIG_DIR);
// path.push("config.toml");
// try_load_file(path)
// })
// .or_else(|| {
// // Read from `$HOME/.pijulconfig`
// let mut path = dirs_next::home_dir()?;
// path.push(GLOBAL_CONFIG_DIR);
// try_load_file(path)
// });
// let Some((file, path)) = res else {
// return Ok((Global::default(), None));
// };
// let mut file = file.map_err(|e| {
// anyhow!("Could not open configuration file at {}", path.display()).context(e)
// })?;
// let mut buf = String::new();
// file.read_to_string(&mut buf).map_err(|e| {
// anyhow!("Could not read configuration file at {}", path.display()).context(e)
// })?;
// debug!("buf = {:?}", buf);
// let global: Global = toml::from_str(&buf).map_err(|e| {
// anyhow!("Could not parse configuration file at {}", path.display()).context(e)
// })?;
// let metadata = file.metadata()?;
// let file_age = metadata
// .modified()?
// .duration_since(std::time::SystemTime::UNIX_EPOCH)?
// .as_secs();
// Ok((global, Some(file_age)))
// }
// }