forked from loliee/ansible-zsh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Refactor user loop and template vars
Refactor tasks/main.yml to use `user_shell` for loop var and ownership. Simplify zshrc.j2 template by removing redundant for-loop and keys check. Introduce `user_options` for streamlined variable access.
- Loading branch information
1 parent
5f6fb46
commit 1adcde8
Showing
2 changed files
with
16 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
# {{ ansible_managed }} | ||
{{ ansible_managed | comment }} | ||
|
||
fpath=("$HOME/.zfunctions" $fpath) | ||
|
||
{%- for username, options in __users__.iteritems() %} | ||
{%- if username == item.key %} | ||
{# Install prompt #} | ||
{%- if options.has_key('zsh_prompt_install') and options.zsh_prompt_install %} | ||
{# Install prompt #} | ||
{%- if 'zsh_prompt_install' in user_options and user_options.zsh_prompt_install %} | ||
|
||
autoload -U promptinit && promptinit | ||
prompt {{ options.zsh_prompt_name | default(zsh_default_prompt_name) }} | ||
prompt {{ user_options.zsh_prompt_name | default(zsh_default_prompt_name) }} | ||
|
||
{%- endif %} | ||
{# Add custom lines #} | ||
{%- if options.has_key('zsh_zshrc_content') and options.zsh_zshrc_content %} | ||
{%- endif %} | ||
{# Add custom lines #} | ||
{%- if 'zsh_zshrc_content' in user_options and user_options.zsh_zshrc_content %} | ||
|
||
{{ options.zsh_zshrc_content }} | ||
{{ user_options.zsh_zshrc_content }} | ||
|
||
{%- endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{%- endif %} |