diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2015-11-17 23:54:06 +0300 |
---|---|---|
committer | Ben Hilburn <bhilburn@gmail.com> | 2015-11-17 23:54:06 +0300 |
commit | b83cfd7515d5d6c0feaa9915f1a89a5d45a2c689 (patch) | |
tree | 14d0355d50ea630e379c93885066bc15c3da9479 /functions | |
parent | 85fd338d36d6b3558b174efe54576734cb3c0f40 (diff) | |
parent | f9957ca5592df0ab992d3750e18ee6f61b3e3002 (diff) |
Merge pull request #143 from dritter/segment_deprecation_helpers
Added segment deprecation helper
Diffstat (limited to 'functions')
-rw-r--r-- | functions/utilities.zsh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/functions/utilities.zsh b/functions/utilities.zsh index 80a38977..f855caf5 100644 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -118,3 +118,19 @@ if [[ "$OS" == 'OSX' ]]; then SED_EXTENDED_REGEX_PARAMETER="-E" fi fi + +# Print a deprecation warning if an old segment is in use. +# Takes the name of an associative array that contains the +# deprecated segments as keys, the values contain the new +# segment names. +print_deprecation_warning() { + typeset -AH raw_deprecated_segments + raw_deprecated_segments=(${(kvP@)1}) + + for key in ${(@k)raw_deprecated_segments}; do + if [[ -n "${POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[(r)$key]}" ]] || [[ -n "${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[(r)$key]}" ]]; then + # segment is deprecated + print -P "%F{yellow}Warning!%f The '$key' segment is deprecated. Use '%F{blue}${raw_deprecated_segments[$key]}%f' instead. For more informations, have a look at the CHANGELOG.md." + fi + done +} |