SuperCuber / dotter

A dotfile manager and templater written in rust 🦀
The Unlicense
882 stars 46 forks source link

[BUG] Included file `windows.toml` can't use more specific key to override #83

Closed younger-1 closed 3 years ago

younger-1 commented 3 years ago

Environment

Description

In included file windows.toml, I had [vim.files] section. It worked when it was:

[vim.files]
vimrc = { target = "~/_vimrc", type = "symbolic" }
gvimrc = { target = "~/_gvimrc", type = "symbolic" }

But it failed when I want to use more specific key to override the vim path

[vim.files]
vimrc.target = "~/_vimrc"
gvimrc.target = "~/_gvimrc"

Reproduction

Here is my config: global.toml

[helpers]

[default]
depends = []

[default.files]
"conda.yml" = "~/.condarc"
gitconfig = "~/.gitconfig"

[vim.files]
vimrc = { target = "~/.vimrc", type = "symbolic" }
gvimrc = { target = "~/.gvimrc", type = "symbolic" }

[default.variables]

windows.toml

[vim.files]
vimrc.target = "~/_vimrc"
gvimrc.target = "~/_gvimrc"

local.toml

includes = [".dotter/windows.toml"]

packages = ["default", "vim"]

Expected behavior

dotter.exe should deployed successfully.

Actual behavior

dotter.exe compained when executed dotter -d deploy

[ERROR] Failed to deploy
Caused by:
    get a configuration
    merge configuration files
    including file ".dotter/windows.toml"
    load file
    deserialize file contents
    data did not match any variant of untagged enum FileTargetOuterRepr for key `vim.files.vimrc`
SuperCuber commented 3 years ago

Yeah this is intended right now because it massively simplifies parsing and loading the configuration. I don't think implementing support for this is worth the development time and complexity - just state the type again in the included file.

PRs welcome :)

younger-1 commented 3 years ago

Thanks for your explanation. 😃