MCPcopy Create free account
hub / github.com/alt-art/commit / select_custom_config_path

Function select_custom_config_path

src/config/mod.rs:10–30  ·  view source on GitHub ↗
(config: Option<PathBuf>)

Source from the content-addressed store, hash-verified

8use crate::commit_pattern::CommitPattern;
9
10fn select_custom_config_path(config: Option<PathBuf>) -> Result<PathBuf> {
11 match config {
12 Some(config_path) => {
13 if config_path.exists() {
14 if !config_path.is_file() {
15 return Err(anyhow!(
16 "Config file path is not a file: {}",
17 config_path.display()
18 ));
19 }
20 Ok(config_path)
21 } else {
22 Err(anyhow!(
23 "Config file does not exist: {}",
24 config_path.display()
25 ))
26 }
27 }
28 None => get_config_path(),
29 }
30}
31
32fn search_config_file_on_parents() -> Result<Option<PathBuf>> {
33 let current_dir = std::env::current_dir()?;

Callers 2

get_patternFunction · 0.85

Calls 1

get_config_pathFunction · 0.85

Tested by 1