1pub mod error;
2pub mod support;
3
4pub type ConfigResult<T, E = error::Error> = Result<T, E>;
5
6#[derive(Debug, Default)]
7pub struct Config {
8 inner: toml::Table,
9 source: Source,
10}
11
12#[derive(Clone, Debug, Default)]
13pub enum Source {
14 #[default]
15 Default,
16 File(String),
17}
18
19impl std::fmt::Display for Source {
20 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21 match self {
22 Self::Default => "default".fmt(f),
23 Self::File(s) => {
24 let workspace = soph_core::support::base_path("").to_string_lossy().to_string();
25
26 s.replace(&workspace, "./").fmt(f)
27 }
28 }
29 }
30}