1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-17 18:20:07 +00:00

Merge pull request #449 from dritter/ordered_icons_list

Sort the output of `get_icon_names` alphabetically
This commit is contained in:
Ben Hilburn 2017-03-20 18:52:52 -07:00 committed by GitHub
commit 33b41ced80

View file

@ -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
}