Add path validation utility and integrate with CLI
This commit is contained in:
6
src/util/fs.rs
Normal file
6
src/util/fs.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub fn path_exists(s: &str) -> Result<PathBuf, String> {
|
||||
let p = PathBuf::from(s);
|
||||
p.exists().then_some(p).ok_or("path does not exist".to_string())
|
||||
}
|
||||
Reference in New Issue
Block a user