style: 格式化代码并优化导入顺序
This commit is contained in:
@@ -7,10 +7,7 @@ use std::path::{Path, PathBuf};
|
||||
pub mod manager;
|
||||
pub mod profile;
|
||||
|
||||
pub use profile::{
|
||||
GitProfile, TokenConfig, TokenType,
|
||||
ProfileComparison
|
||||
};
|
||||
pub use profile::{GitProfile, ProfileComparison, TokenConfig, TokenType};
|
||||
|
||||
/// Application configuration
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -494,24 +491,22 @@ impl AppConfig {
|
||||
|
||||
/// Save configuration to file
|
||||
pub fn save(&self, path: &Path) -> Result<()> {
|
||||
let content = toml::to_string_pretty(self)
|
||||
.context("Failed to serialize config")?;
|
||||
|
||||
let content = toml::to_string_pretty(self).context("Failed to serialize config")?;
|
||||
|
||||
if let Some(parent) = path.parent() {
|
||||
fs::create_dir_all(parent)
|
||||
.with_context(|| format!("Failed to create config directory: {:?}", parent))?;
|
||||
}
|
||||
|
||||
|
||||
fs::write(path, content)
|
||||
.with_context(|| format!("Failed to write config file: {:?}", path))?;
|
||||
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get default config path
|
||||
pub fn default_path() -> Result<PathBuf> {
|
||||
let config_dir = dirs::config_dir()
|
||||
.context("Could not find config directory")?;
|
||||
let config_dir = dirs::config_dir().context("Could not find config directory")?;
|
||||
Ok(config_dir.join("quicommit").join("config.toml"))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user