rossmacarthur/sheldon

invalid type: map, expected a string for key `templates.defer`

sidmadala opened this issue · 5 comments

Sheldon Version: sheldon 0.7.1
OS: MacOS 12.6
Terminal: Alacritty 0.11.0 (8dbaa0b)

My config:

# `sheldon` configuration file
# ----------------------------
#
# You can modify this file directly or you can use one of the following
# `sheldon` commands which are provided to assist in editing the config file:
#
# - `sheldon add` to add a new plugin to the config file
# - `sheldon edit` to open up the config file in the default editor
# - `sheldon remove` to remove a plugin from the config file
#
# See the documentation for more https://github.com/rossmacarthur/sheldon#readme


shell = "zsh"

# Default apply defer
apply = ["defer"]

[templates]
defer = { value = 'zsh-defer source "{{ file }}"', each = true }

[plugins]


# Non-deferred plugins 
# [plugins.zsh-defer]
github = "romkatv/zsh-defer"
apply = ["source"]

[plugins.docker-zsh-completion]
github = "greymd/docker-zsh-completion"
apply = ["source"]

[plugins.conda-zsh-completion]
github = "esc/conda-zsh-completion"
apply = ["source"]

[plugins.rust-zsh-completions]
github = "ryutok/rust-zsh-completions"
apply = ["source"]

[plugins.zsh-completions]
github = "zsh-users/zsh-completions"
apply = ["source"]

[plugins.zsh-autosuggestions]
github = "zsh-users/zsh-autosuggestions"
use = ["{{ name }}.zsh"]

[plugins.zsh-syntax-highlighting]
github = "zsh-users/zsh-syntax-highlighting"

[plugins.compinit]
inline = 'autoload -Uz compinit && zsh-defer compinit'

Bug Description:

Getting an error on startup of Alacritty that can be traced back to toml-rs library that Sheldon uses:

error: failed to load config file
  due to: failed to deserialize contents as TOML
  due to: invalid type: map, expected a string for key `templates.defer` at line 20 column 9

Expected Behavior:

No error on startup

Hi, please see the RELEASE notes for breaking changes between 0.6.x and 0.7.x

https://github.com/rossmacarthur/sheldon/blob/trunk/RELEASES.md#070

The breaking changes relevant to you is this line

Only apply templates per plugin. This effectively removes the each field from the template configuration. Any templates that are applied to each file in a plugin need to now use a for loop. For example:

So basically the templates fields can no longer take the form

[templates]
defer = { value = 'zsh-defer source "{{ file }}"', each = true }

You must now use

[templates]
defer = """{% for file in files %}
zsh-defer source "{{ file }}"
{% endfor %}"""

Thanks this solved it! Should've read the docs first.

Hi @rossmacarthur, I'm having this error:

error: failed to render source
  due to: failed to render template `defer`
  due to: Error rendering "defer" line 1, col 42: Variable "file" not found in strict mode.

@gmcinalli What version of sheldon are you using?

sheldon --version

Sorry... 🤦🏻‍♂️ Problem solved.