{% set salted = salt['pillar.get']('zsh:salted', grains['userhome'] + "/.salted") %}

CMake completions:
  file.managed:
    - name: {{salted}}/completions/_cmake
    - source: https://raw.githubusercontent.com/skroll/zsh-cmake-completion/master/_cmake
    - source_hash: sha1=e1ecae244d4ea02c457b5fdfe60adcd294968054
    - makedirs: true

{% for completion in salt['pillar.get']('zsh:completions', {}) %}
{{salted}}/completions/_{{completion.keys()[0]}}:
  file.managed:
    - makedirs: true
    - contents: |-
        #compdef {{completion.keys()[0]}}
        {{completion.values()[0]}}
{% endfor %}

{% set salted = salt['pillar.get']('zsh:salted', grains['userhome'] + "/.salted") %}

CMake completions:
  file.managed:
    - name: {{salted}}/completions/_cmake
    - source: https://raw.githubusercontent.com/skroll/zsh-cmake-completion/master/_cmake
    - source_hash: sha1=e1ecae244d4ea02c457b5fdfe60adcd294968054
    - makedirs: true

{% for completion in salt['pillar.get']('zsh:completions', {}) %}
{{salted}}/completions/_{{completion.keys() | first}}:
  file.managed:
    - makedirs: true
    - contents: |-
        #compdef {{completion.keys() | first}}
        {{completion.values() | first}}
{% endfor %}

Use first rather than [0] in Jinja templates
Use first rather than [0] in Jinja templates

Works better with python 3

mdavezac/black-garlic