bookmarks can be added with relative paths now

This commit is contained in:
2025-01-13 23:00:41 +01:00
parent 9f4d522aa3
commit 5cb08dc2c1
+9 -5
View File
@@ -151,11 +151,15 @@ fn list_bookmarks(config: &Config, bookmarks: &mut Bookmarks) -> Result<()> {
} }
fn add_bookmarks(args: &BookmarkSubArgs, config: &Config, bookmarks: &mut Bookmarks) -> Result<()> { fn add_bookmarks(args: &BookmarkSubArgs, config: &Config, bookmarks: &mut Bookmarks) -> Result<()> {
if args.path.is_none() { let mut path = match args.path.clone() {
return Err(Error::other("-- missing path argument")); Some(value) => value,
} else { None => return Err(Error::other("-- missing path argument")),
bookmarks.add_bookmark(&args.name, &args.path.clone().unwrap())?; };
} path = match path.canonicalize() {
Ok(value) => value,
Err(error) => return Err(Error::other(error.to_string())),
};
bookmarks.add_bookmark(&args.name, &path)?;
Ok(()) Ok(())
} }