feat: load config file

This commit is contained in:
Paul Campbell 2024-11-29 19:19:36 +00:00
parent 8075de496b
commit f9352c551c
3 changed files with 33 additions and 7 deletions

View file

@ -7,19 +7,19 @@ edition = "2021"
#bytes = "1.9" #bytes = "1.9"
clap = { version = "4.5", features = ["cargo", "derive"] } clap = { version = "4.5", features = ["cargo", "derive"] }
color-eyre = "0.6" color-eyre = "0.6"
#derive_more = { version = "1.0", features = [ derive_more = { version = "1.0", features = [
# "as_ref", "as_ref",
# "constructor", "constructor",
# "deref", # "deref",
# "display", # "display",
# "from", "from",
#] } ] }
kxio = {path = "../kxio/"} kxio = {path = "../kxio/"}
# kxio = "3.1" # kxio = "3.1"
#serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
#serde_json = "1.0" #serde_json = "1.0"
tokio = { version = "1.41", features = ["full"] } tokio = { version = "1.41", features = ["full"] }
#toml = "0.8" toml = "0.8"
#tracing= "0.1" #tracing= "0.1"
#tracing-subscriber = "0.3" #tracing-subscriber = "0.3"

25
src/config.rs Normal file
View file

@ -0,0 +1,25 @@
//
// use color_eyre::Result;
// use crate::{f, s, Ctx, NAME};
#[derive(
Clone,
Debug,
derive_more::From,
PartialEq,
Eq,
PartialOrd,
Ord,
derive_more::AsRef,
serde::Deserialize,
derive_more::Constructor,
)]
pub struct AppConfig {}
// impl AppConfig {
// pub fn load(ctx: &Ctx) -> Result<Self> {
// let file = ctx.fs.base().join(f!("{NAME}.toml"));
// let str = ctx.fs.file(&file).reader()?;
// Ok(toml::from_str(s!(str).as_str())?)
// }
// }

View file

@ -4,6 +4,7 @@ use std::path::PathBuf;
use clap::Parser; use clap::Parser;
use kxio::{fs::FileSystem, net::Net}; use kxio::{fs::FileSystem, net::Net};
mod config;
mod init; mod init;
mod macros; mod macros;
mod template; mod template;