pub struct Config {
pub structure: String,
pub concurrency: usize,
pub sync_mode: SyncMode,
pub default_workspace: Option<String>,
pub refresh_interval: u64,
pub clone: ConfigCloneOptions,
pub filters: FilterOptions,
pub workspaces: Vec<String>,
}Expand description
Full application configuration.
Fields§
§structure: StringDirectory structure pattern Placeholders: {provider}, {org}, {repo}
concurrency: usizeNumber of parallel operations
sync_mode: SyncModeSync behavior
default_workspace: Option<String>Default workspace path (used when –workspace is not specified and multiple exist)
refresh_interval: u64Dashboard auto-refresh interval in seconds (5–3600, default 30)
clone: ConfigCloneOptionsClone options
filters: FilterOptionsFilter options
workspaces: Vec<String>Registry of known workspace root paths (tilde-collapsed).
Implementations§
Source§impl Config
impl Config
Sourcepub fn default_path() -> Result<PathBuf, AppError>
pub fn default_path() -> Result<PathBuf, AppError>
Returns the default config file path (~/.config/git-same/config.toml).
When GIT_SAME_CONFIG_DIR is set to an absolute path, that directory is used instead.
This allows tests to override config location on Windows (where dirs-sys ignores APPDATA).
Sourcepub fn load() -> Result<Self, AppError>
pub fn load() -> Result<Self, AppError>
Load configuration from the default path, or return defaults if file doesn’t exist.
Sourcepub fn load_from(path: &Path) -> Result<Self, AppError>
pub fn load_from(path: &Path) -> Result<Self, AppError>
Load configuration from a specific file, or return defaults if file doesn’t exist.
Sourcepub fn default_toml() -> String
pub fn default_toml() -> String
Generate the default configuration file content.
Sourcepub fn save_default_workspace(workspace: Option<&str>) -> Result<(), AppError>
pub fn save_default_workspace(workspace: Option<&str>) -> Result<(), AppError>
Save the default_workspace setting to the config file at the default path.
Sourcepub fn save_default_workspace_to(
path: &Path,
workspace: Option<&str>,
) -> Result<(), AppError>
pub fn save_default_workspace_to( path: &Path, workspace: Option<&str>, ) -> Result<(), AppError>
Save the default_workspace setting to a specific config file.
Uses targeted text replacement to preserve comments and formatting.
Sourcepub fn add_to_registry(path: &str) -> Result<(), AppError>
pub fn add_to_registry(path: &str) -> Result<(), AppError>
Add a workspace path to the global registry.
Sourcepub fn add_to_registry_at(
config_path: &Path,
path: &str,
) -> Result<(), AppError>
pub fn add_to_registry_at( config_path: &Path, path: &str, ) -> Result<(), AppError>
Add a workspace path to the registry in a specific config file.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more