pub struct XvcConfig {
pub current_dir: XvcConfigOption<AbsolutePath>,
pub config_maps: Vec<XvcConfigMap>,
pub the_config: HashMap<String, XvcConfigValue>,
pub init_params: XvcConfigParams,
}
Expand description
Keeps track of all Xvc configuration.
It’s created by [XvcRoot] using the options from [XvcConfigInitParams]. Keeps the current directory, that can also be set manually from the command line. It loads several config maps (one for each XvcConfigOptionSource) and cascadingly merges them to get an actual configuration.
Fields§
§current_dir: XvcConfigOption<AbsolutePath>
Current directory. It can be set with xvc -C option
config_maps: Vec<XvcConfigMap>
Configuration values for each level
the_config: HashMap<String, XvcConfigValue>
The current configuration map, updated cascadingly
init_params: XvcConfigParams
The init params used to create this config
Implementations§
Source§impl XvcConfig
impl XvcConfig
Sourcepub fn get_str(&self, key: &str) -> Result<XvcConfigOption<String>, Error>
pub fn get_str(&self, key: &str) -> Result<XvcConfigOption<String>, Error>
Returns string value for key
.
The value is parsed from the corresponding TomlValue stored in [self.the_config
].
Sourcepub fn get_bool(&self, key: &str) -> Result<XvcConfigOption<bool>, Error>
pub fn get_bool(&self, key: &str) -> Result<XvcConfigOption<bool>, Error>
Returns bool value for key
.
The value is parsed from the corresponding TomlValue stored in [self.the_config
].
Sourcepub fn get_int(&self, key: &str) -> Result<XvcConfigOption<i64>, Error>
pub fn get_int(&self, key: &str) -> Result<XvcConfigOption<i64>, Error>
Returns int value for key
.
The value is parsed from the corresponding TomlValue stored in [self.the_config
].
Sourcepub fn get_float(&self, key: &str) -> Result<XvcConfigOption<f64>, Error>
pub fn get_float(&self, key: &str) -> Result<XvcConfigOption<f64>, Error>
Returns float value for key
.
The value is parsed from the corresponding TomlValue stored in [self.the_config
].
Sourcepub fn get_toml_value(&self, key: &str) -> Result<XvcConfigOption<Value>, Error>
pub fn get_toml_value(&self, key: &str) -> Result<XvcConfigOption<Value>, Error>
Returns TOML value corresponding to key.
It’s returned without parsing from [self.the_config
]
Sourcepub fn system_config_file() -> Result<PathBuf, Error>
pub fn system_config_file() -> Result<PathBuf, Error>
Return the system configuration file path for Xvc
Sourcepub fn user_config_file() -> Result<PathBuf, Error>
pub fn user_config_file() -> Result<PathBuf, Error>
Return the user configuration file path for Xvc
Sourcepub fn new(p: XvcConfigParams) -> Result<XvcConfig, Error>
pub fn new(p: XvcConfigParams) -> Result<XvcConfig, Error>
Loads all config files Overrides all options with the given key=value style options in the command line
Sourcepub fn current_dir(&self) -> Result<&AbsolutePath, Error>
pub fn current_dir(&self) -> Result<&AbsolutePath, Error>
Where do we run the command?
This can be modified by options in the command line, so it’s not always equal to std::env::current_dir()
Sourcepub fn guid(&self) -> Option<String>
pub fn guid(&self) -> Option<String>
Globally Unique Identified for the Xvc Repository / Project
It’s stored in core.guid
option.
It’s created in [XvcRoot::init
] and shouldn’t be tampered with.
Storage commands use this to create different paths for different Xvc projects.
Sourcepub fn verbosity(&self) -> XvcVerbosity
pub fn verbosity(&self) -> XvcVerbosity
The current verbosity level.
Set with core.verbosity
option.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for XvcConfig
impl RefUnwindSafe for XvcConfig
impl Send for XvcConfig
impl Sync for XvcConfig
impl Unpin for XvcConfig
impl UnwindSafe for XvcConfig
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