Renamed crates and modules

This commit is contained in:
2024-02-04 01:57:02 -06:00
parent 79ae00b7a8
commit 3410392a9a
11 changed files with 26 additions and 25 deletions

View File

@@ -1 +1 @@
pub mod args; pub mod parse;

View File

@@ -5,7 +5,7 @@ use std::fmt;
use toml::Table; use toml::Table;
use crate::dotfile::dotfile::{self, ManagedDotfile}; use crate::dotfile::dot::{self, ManagedDotfile};
@@ -104,7 +104,7 @@ pub enum ConfigParseError {
DotfilesParseError, DotfilesParseError,
DotfilesArrayParseError, DotfilesArrayParseError,
DotfilesTableParseError, DotfilesTableParseError,
DotfilesCreateError(dotfile::DotfileError), DotfilesCreateError(dot::DotfileError),
} }
impl Error for ConfigParseError {} impl Error for ConfigParseError {}
@@ -155,8 +155,8 @@ impl From<toml::de::Error> for ConfigParseError {
} }
} }
impl From<dotfile::DotfileError> for ConfigParseError { impl From<dot::DotfileError> for ConfigParseError {
fn from(error: dotfile::DotfileError) -> ConfigParseError { fn from(error: dot::DotfileError) -> ConfigParseError {
ConfigParseError::DotfilesCreateError(error) ConfigParseError::DotfilesCreateError(error)
} }
} }

View File

@@ -1 +1 @@
pub mod config; pub mod cfg;

View File

@@ -4,8 +4,8 @@ use std::env;
use std::fs; use std::fs;
use std::fmt; use std::fmt;
use crate::dotfile::dir; use crate::fs::dir;
use crate::dotfile::file; use crate::fs::file;

View File

@@ -1,4 +1 @@
mod dir; pub mod dot;
mod file;
pub mod dotfile;

View File

@@ -3,7 +3,7 @@ use std::path::PathBuf;
use std::fmt; use std::fmt;
use std::error::Error; use std::error::Error;
use crate::dotfile::file::{self, File}; use crate::fs::file::{self, File};

2
src/fs/mod.rs Normal file
View File

@@ -0,0 +1,2 @@
pub mod dir;
pub mod file;

View File

@@ -3,14 +3,16 @@ use std::fmt;
use clap::ArgMatches; use clap::ArgMatches;
use crate::config::config::Config; use crate::config::cfg;
use crate::dotfile::dot;
pub mod config; pub mod config;
pub mod dotfile; pub mod dotfile;
pub mod args; pub mod args;
pub mod fs;
pub fn run(args: ArgMatches, config: Config) -> Result<(), ManagerError> { pub fn run(args: ArgMatches, config: cfg::Config) -> Result<(), ManagerError> {
let copy_to_sys = args.get_flag("from-git"); let copy_to_sys = args.get_flag("from-git");
@@ -41,8 +43,8 @@ pub fn run(args: ArgMatches, config: Config) -> Result<(), ManagerError> {
#[derive(Debug)] #[derive(Debug)]
pub enum ManagerError { pub enum ManagerError {
DotfileCopyError(dotfile::dotfile::DotfileError), DotfileCopyError(dot::DotfileError),
ConfigParseError(config::config::ConfigParseError), ConfigParseError(cfg::ConfigParseError),
} }
impl Error for ManagerError {} impl Error for ManagerError {}
@@ -60,14 +62,14 @@ impl fmt::Display for ManagerError {
} }
} }
impl From<dotfile::dotfile::DotfileError> for ManagerError { impl From<dot::DotfileError> for ManagerError {
fn from(error: dotfile::dotfile::DotfileError) -> ManagerError { fn from(error: dot::DotfileError) -> ManagerError {
ManagerError::DotfileCopyError(error) ManagerError::DotfileCopyError(error)
} }
} }
impl From<config::config::ConfigParseError> for ManagerError { impl From<cfg::ConfigParseError> for ManagerError {
fn from(error: config::config::ConfigParseError) -> ManagerError { fn from(error: cfg::ConfigParseError) -> ManagerError {
ManagerError::ConfigParseError(error) ManagerError::ConfigParseError(error)
} }
} }

View File

@@ -1,13 +1,13 @@
use std::path::PathBuf; use std::path::PathBuf;
use dotfiles_manager::args::args; use dotfiles_manager::args::parse;
use dotfiles_manager::config::config::Config; use dotfiles_manager::config::cfg;
fn main() -> Result<(), dotfiles_manager::ManagerError> { fn main() -> Result<(), dotfiles_manager::ManagerError> {
let args = args::parse_args(); let args = parse::parse_args();
let program_config = Config::parse(PathBuf::from("/home/eesim/.config/dotfiles/config"))?; let program_config = cfg::Config::parse(PathBuf::from("/home/eesim/.config/dotfiles/config"))?;
dotfiles_manager::run(args, program_config) dotfiles_manager::run(args, program_config)