SuperCuber / dotter

A dotfile manager and templater written in rust 🦀
The Unlicense
900 stars 48 forks source link

[BUG] Not creating directory symbolic #176

Open niamotullah opened 4 months ago

niamotullah commented 4 months ago

Environment

Description

nvim = "~/.config/nvim" in config instead of creating a directory symlink it creates folder nvim and symlinks every individual files of nvim/ directory. now if i create any new files or incase application creates any new config on their respective config directory, it won't store that new config on the .dotfiles/nvim directory.

Reproduction

global.toml

[helpers]

[default]
depends = []

[default.files]
dotter = ""
# nvim = "~/.config/nvim"
"zsh/zshrc" = "~/.zshrc"
"zsh/zsh_history" = "~/.zsh_history"
"zsh/oh-my-zsh" = "~/.oh-my-zsh"
test_dir = "~/.test_dir"

[default.variables]

[settings]
default_target_type = "symbolic"

local.toml

includes = []
packages = ["default"]

[files]

[variables]

file structure:

➜  ~ tree -L 2 .dotfiles               
.dotfiles
├── dotter
├── nvim
│   ├── init.lua
│   ├── lazy-lock.json
│   ├── lazyvim.json
│   ├── LICENSE
│   ├── lua
│   ├── README.md
│   └── stylua.toml
└── zsh
    ├── oh-my-zsh
    ├── zsh_history
    └── zshrc

5 directories, 9 files]

Actual behavior

➜  .dotfiles git:(master) ✗ ./dotter deploy
➜  .dotfiles git:(master) ✗ cd ~
➜  ~ file .oh-my-zsh 
.oh-my-zsh: directory

➜  ~ file .oh-my-zsh/plugins 
.oh-my-zsh/plugins: directory

➜  ~ file .oh-my-zsh/oh-my-zsh.sh 
.oh-my-zsh/oh-my-zsh.sh: symbolic link to /home/niamotullah/.dotfiles/zsh/oh-my-zsh/oh-my-zsh.sh

➜  ~ echo "something" > .oh-my-zsh/test 
➜  ~ file .oh-my-zsh/test              
.oh-my-zsh/test: ASCII text

➜  ~ file .dotfiles/zsh/oh-my-zsh/test
.dotfiles/zsh/oh-my-zsh/test: cannot open `.dotfiles/zsh/oh-my-zsh/test' (No such file or directory)

Expected behavior


➜  ~ rm -rf .oh-my-zsh 
➜  ~ ln -s .dotfiles/zsh/oh-my-zsh .oh-my-zsh 
➜  ~ file .oh-my-zsh 
.oh-my-zsh: symbolic link to .dotfiles/zsh/oh-my-zsh

➜  ~ file .oh-my-zsh/oh-my-zsh.sh 
.oh-my-zsh/oh-my-zsh.sh: ASCII text

➜  ~ file .oh-my-zsh/plugins     
.oh-my-zsh/plugins: directory

➜  ~ echo "something" > .oh-my-zsh/test
➜  ~ file .oh-my-zsh/test 
.oh-my-zsh/test: ASCII text

➜  ~ file .dotfiles/zsh/oh-my-zsh/test 
.dotfiles/zsh/oh-my-zsh/test: ASCII text
``
SuperCuber commented 4 months ago

This is expected behavior, and there is an option to disable it. It was added and never documented 🙃 whoops!

Either specify recurse = false before your [helpers] section to disable this behavior globally, or specify

nvim = {type = "symbolic", target = "~/.config/nvim", recurse = false}

to disable for a specific folder.

Leaving this open for now as a reminder to self:

niamotullah commented 4 months ago

This is expected behavior, and there is an option to disable it. It was added and never documented 🙃 whoops!

Either specify recurse = false before your [helpers] section to disable this behavior globally, or specify

nvim = {type = "symbolic", target = "~/.config/nvim", recurse = false}

to disable for a specific folder.

Leaving this open for now as a reminder to self:

* [ ]  Add documentation to the wiki about global and per-file option

* [ ]  Perhaps move `recurse` into `settings` section

Error:

$ ./dotter -vvv
[TRACE] [src/main.rs:79] Loaded options: Options {
    global_config: ".dotter/global.toml",
    local_config: ".dotter/local.toml",
    cache_file: ".dotter/cache.toml",
    cache_directory: ".dotter/cache",
    pre_deploy: ".dotter/pre_deploy.sh",
    post_deploy: ".dotter/post_deploy.sh",
    pre_undeploy: ".dotter/pre_undeploy.sh",
    post_undeploy: ".dotter/post_undeploy.sh",
    dry_run: false,
    verbosity: 3,
    quiet: false,
    force: false,
    noconfirm: false,
    patch: false,
    diff_context_lines: 3,
    action: None,
}
[DEBUG] [src/main.rs:95] Deploying...
[TRACE] [src/deploy.rs:28] Manual patch: None
[ERROR] Failed to deploy
Caused by:
    get a configuration
    load global config ".dotter/global.toml"
    deserialize file contents
    invalid type: boolean `false`, expected struct Package

global.toml:

recurse = false

[helpers]

[default]
depends = []

[default.files]
"README.md" = ""
dotter = ""
nvim = "~/.config/nvim"

[default.variables]

[settings]
default_target_type = "symbolic"
SuperCuber commented 4 months ago

You're right. I've started work on moving it to the part of the code that reads from global.toml

https://github.com/SuperCuber/dotter/pull/177

Encountered a weird problem when moving between recursive and non recursive dir, ill work on it later

niamotullah commented 4 months ago

You're right. I've started work on moving it to the part of the code that reads from global.toml

177

Encountered a weird problem when moving between recursive and non recursive dir, ill work on it later

I've tried it, mine seems working.. can you look at it commit