diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2017-03-21 04:52:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-21 04:52:52 +0300 |
commit | 33b41ced8057ac5045e848bfa01c797d55a0b24e (patch) | |
tree | 859d3506fbe0b36d603b7a421971923ff8b0233c /functions/icons.zsh | |
parent | dca0f7f9177a76f4d8ea8ed9d03f46b114f0319d (diff) | |
parent | f89104f68f1598d89fe35956060a6410744a5be8 (diff) |
Merge pull request #449 from dritter/ordered_icons_list
Sort the output of `get_icon_names` alphabetically
Diffstat (limited to 'functions/icons.zsh')
-rw-r--r-- | functions/icons.zsh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/functions/icons.zsh b/functions/icons.zsh index 24de293c..343b7685 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -307,8 +307,20 @@ function print_icon() { fi } +# Get a list of configured icons +# * $1 string - If "original", then the original icons are printed, +# otherwise "print_icon" is used, which takes the users +# overrides into account. get_icon_names() { - for key in ${(@k)icons}; do - echo "POWERLEVEL9K_$key: ${icons[$key]}" + # Iterate over a ordered list of keys of the icons array + for key in ${(@kon)icons}; do + echo -n "POWERLEVEL9K_$key: " + if [[ "${1}" == "original" ]]; then + # print the original icons as they are defined in the array above + echo "${icons[$key]}" + else + # print the icons as they are configured by the user + echo "$(print_icon "$key")" + fi done } |