fix: fix dotenv loader inconsistent and many ui issues

This commit is contained in:
2025-06-25 06:36:15 +08:00
parent 41ff5c2a11
commit 003d8840fd
29 changed files with 481 additions and 168 deletions

View File

@@ -1,5 +1,3 @@
pub mod errors;
pub mod loose;
pub use errors::OptDynErr;
pub use loose::BooleanLike;

View File

@@ -1,19 +0,0 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BooleanLike {
Boolean(bool),
String(String),
Number(i32),
}
impl BooleanLike {
pub fn as_bool(&self) -> bool {
match self {
BooleanLike::Boolean(b) => *b,
BooleanLike::String(s) => s.to_lowercase() == "true",
BooleanLike::Number(n) => *n != 0,
}
}
}