pub struct Config {
pub project: Option<ProjectConfig>,
pub ports: BTreeMap<String, u16>,
pub hooks: HooksConfig,
pub cache: CacheConfig,
pub files: FilesConfig,
pub docker: DockerConfig,
}Expand description
Strongly-typed configuration parsed from .git-claw.toml or ~/.git-claw/config.toml.
Fields§
§project: Option<ProjectConfig>§ports: BTreeMap<String, u16>§hooks: HooksConfig§cache: CacheConfig§files: FilesConfig§docker: DockerConfigImplementations§
Source§impl Config
impl Config
Sourcepub fn default_for_repo(repo_name: &str) -> Self
pub fn default_for_repo(repo_name: &str) -> Self
Constructs default configuration for a given repository name.
Sourcepub fn main_branch(&self) -> &str
pub fn main_branch(&self) -> &str
Returns the configured main branch name.
Sourcepub fn remote(&self) -> Option<&str>
pub fn remote(&self) -> Option<&str>
Returns the configured remote repository name, if specified.
Sourcepub fn worktree_root(&self, repo_name: &str) -> String
pub fn worktree_root(&self, repo_name: &str) -> String
Returns the configured worktree root path, falling back to centralized default if empty.
Sourcepub fn merge_with(&mut self, other: Config)
pub fn merge_with(&mut self, other: Config)
Merges other config on top of self, where non-default fields in other take precedence.
Sourcepub fn parse_toml_str(
toml_str: &str,
repo_name: &str,
) -> Result<Self, ConfigError>
pub fn parse_toml_str( toml_str: &str, repo_name: &str, ) -> Result<Self, ConfigError>
Parses a TOML string into Config, filling missing fields with defaults.
Sourcepub fn load_or_default(
path: &Path,
repo_name: &str,
) -> Result<Self, ConfigError>
pub fn load_or_default( path: &Path, repo_name: &str, ) -> Result<Self, ConfigError>
Loads configuration respecting the two-tier hierarchy:
- Hardcoded system defaults.
- Merged with global user config (
~/.git-claw/config.tomlorGIT_CLAW_GLOBAL_CONFIG). - Merged with local repository config (
path).
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Config
impl StructuralPartialEq for Config
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.