aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Bossing <max@bossi.ng>2025-07-19 17:00:42 +0200
committerMax Bossing <max@bossi.ng>2025-07-19 17:00:42 +0200
commitbe07419e395cdb27607ceaa67b76a7ba25972d96 (patch)
treea0223ae6ebc2ee30bb0a4abc24bc10a8b944726e
parent15bcc6147fff93a8862ada7d564bd558bba5c6e4 (diff)
feat: respect absolute/relative paths in dest field
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--README.md8
-rw-r--r--src/dots.rs4
4 files changed, 8 insertions, 8 deletions
diff --git a/Cargo.lock b/Cargo.lock
index e1b2bb4..70f66c6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -133,7 +133,7 @@ dependencies = [
[[package]]
name = "dots"
-version = "2.0.0"
+version = "2.1.0"
dependencies = [
"clap",
"dirs",
diff --git a/Cargo.toml b/Cargo.toml
index c158254..bab7836 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "dots"
description = "System-agnostic dotfile-deployer "
-version = "2.0.0"
+version = "2.1.0"
edition = "2024"
[dependencies]
diff --git a/README.md b/README.md
index f72ae70..2f74919 100644
--- a/README.md
+++ b/README.md
@@ -33,11 +33,11 @@ dots_dir = "/home/anon/dots" # If omitted, defaults to working directory
[[dot]]
src = "nvim" # Resolved against dots_dir
-dest = ".config/nvim" # Resolved against $HOME
+dest = ".config/nvim" # Relative paths are resolved against $HOME
[[dot]]
-src = "fish"
-dest = ".config/fish"
+src = "Xmodmap"
+dest = "/etc/X11" # Absolute paths are respected
[[dot]]
src = "tmux.conf"
@@ -53,7 +53,7 @@ dots deploy --config some_file.dots.toml
## Todo
- [x] Allow to "undeploy", eg. to automatically remove symlinks created by `dots`
-- [ ] Absolute Paths in dest field
+- [x] Absolute Paths in dest field
## License
This is licensed under the [MIT](LICENSE) license.
diff --git a/src/dots.rs b/src/dots.rs
index 5b75254..0259c0c 100644
--- a/src/dots.rs
+++ b/src/dots.rs
@@ -8,7 +8,7 @@ pub fn deploy_dots(dots: Vec<Dot>, dots_dir: PathBuf) {
let prepended_dots = dots.iter().map(|m|
Dot {
source: dots_dir.join(&m.source),
- destination: prepend_user_dir(&m.destination)
+ destination: if m.destination.is_absolute() { m.destination.clone() } else { prepend_user_dir(&m.destination) }
}
);
@@ -45,4 +45,4 @@ pub fn unlink_dots(dots: Vec<Dot>, dots_dir: PathBuf) {
fn prepend_user_dir(path: &PathBuf) -> PathBuf {
home_dir().unwrap().join(path)
-} \ No newline at end of file
+}