mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 00:35:38 +08:00
refactor: impl as struct methods
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
config::{ClashController, ProfilesConfig, VergeConfig},
|
||||
config::{ClashController, VergeConfig},
|
||||
utils::app_home_dir,
|
||||
};
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
@@ -103,20 +103,6 @@ pub fn read_clash_controller() -> ClashController {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get Profiles Config
|
||||
pub fn read_profiles() -> ProfilesConfig {
|
||||
read_yaml::<ProfilesConfig>(app_home_dir().join("profiles.yaml"))
|
||||
}
|
||||
|
||||
/// Save Verge App Config
|
||||
pub fn save_profiles(profiles: &ProfilesConfig) -> Result<(), String> {
|
||||
save_yaml(
|
||||
app_home_dir().join("profiles.yaml"),
|
||||
profiles,
|
||||
Some("# Profiles Config for Clash Verge\n\n"),
|
||||
)
|
||||
}
|
||||
|
||||
/// Get the `verge.yaml`
|
||||
pub fn read_verge() -> VergeConfig {
|
||||
read_yaml::<VergeConfig>(app_home_dir().join("verge.yaml"))
|
||||
|
||||
Reference in New Issue
Block a user