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

View File

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

View File

@@ -3,7 +3,7 @@ use std::path::PathBuf;
use std::fmt;
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 crate::config::config::Config;
use crate::config::cfg;
use crate::dotfile::dot;
pub mod config;
pub mod dotfile;
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");
@@ -41,8 +43,8 @@ pub fn run(args: ArgMatches, config: Config) -> Result<(), ManagerError> {
#[derive(Debug)]
pub enum ManagerError {
DotfileCopyError(dotfile::dotfile::DotfileError),
ConfigParseError(config::config::ConfigParseError),
DotfileCopyError(dot::DotfileError),
ConfigParseError(cfg::ConfigParseError),
}
impl Error for ManagerError {}
@@ -60,14 +62,14 @@ impl fmt::Display for ManagerError {
}
}
impl From<dotfile::dotfile::DotfileError> for ManagerError {
fn from(error: dotfile::dotfile::DotfileError) -> ManagerError {
impl From<dot::DotfileError> for ManagerError {
fn from(error: dot::DotfileError) -> ManagerError {
ManagerError::DotfileCopyError(error)
}
}
impl From<config::config::ConfigParseError> for ManagerError {
fn from(error: config::config::ConfigParseError) -> ManagerError {
impl From<cfg::ConfigParseError> for ManagerError {
fn from(error: cfg::ConfigParseError) -> ManagerError {
ManagerError::ConfigParseError(error)
}
}

View File

@@ -1,13 +1,13 @@
use std::path::PathBuf;
use dotfiles_manager::args::args;
use dotfiles_manager::config::config::Config;
use dotfiles_manager::args::parse;
use dotfiles_manager::config::cfg;
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)