pub struct XvcConfig {
pub current_dir: AbsolutePath,
/* private fields */
}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: AbsolutePathCurrent directory. It can be set with xvc -C option
Implementations§
Source§impl XvcConfig
impl XvcConfig
Sourcepub fn new_v2(config_init_params: &XvcLoadParams) -> Result<XvcConfig, Error>
pub fn new_v2(config_init_params: &XvcLoadParams) -> Result<XvcConfig, Error>
Loads the default configuration from p.
The configuration must be a valid TOML document.
Sourcepub fn config(&self) -> &XvcConfiguration
pub fn config(&self) -> &XvcConfiguration
Return the current configuration
Sourcepub fn system_config_file() -> Result<PathBuf, Error>
pub fn system_config_file() -> Result<PathBuf, Error>
Return the system configuration file path for Xvc FIXME: Return Absolute Path
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 load_optional_config_from_file(
path: &Path,
) -> Result<XvcOptionalConfiguration, Error>
pub fn load_optional_config_from_file( path: &Path, ) -> Result<XvcOptionalConfiguration, Error>
Load an XvcOptionalConfiguration from a file or returns a blank config if the file is not found
Sourcepub fn load_command_line_config(
cli_opt_vector: &Option<Vec<String>>,
) -> Result<XvcOptionalConfiguration, Error>
pub fn load_command_line_config( cli_opt_vector: &Option<Vec<String>>, ) -> Result<XvcOptionalConfiguration, Error>
Loads configuration from command line arguments. Parses a vector of key-value strings into an XvcOptionalConfiguration.
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 verbosity(&self) -> XvcVerbosity
pub fn verbosity(&self) -> XvcVerbosity
The current verbosity level.
Set with core.verbosity option.
Sourcepub fn find_value_source(&self, key: &str) -> Option<XvcConfigOptionSource>
pub fn find_value_source(&self, key: &str) -> Option<XvcConfigOptionSource>
Find where a configuration value is defined, by checking configuration layers from highest priority to lowest.
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.