Created
December 31, 2018 12:34
-
-
Save aitor/d6a67fd9aa31905a0a90ebba977aac5f to your computer and use it in GitHub Desktop.
POWERLEVEL9K custom elixir/erlang prompt segment
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
POWERLEVEL9K_ELIXIR_ICON=$'\ue62d' | |
prompt_asdf_elixir() { | |
if [ $commands[asdf] ]; then | |
ELIXIR_ICON=$'\ue62d' | |
local asdf_global_conf="$HOME/.tool-versions" | |
local version_regex="s/^\([.0-9]*\).*/\1/p" | |
local config_regex="s/.*(set by \(.*\))/\1/p" | |
local elixir_current="$(asdf current elixir)" | |
local elixir_current_version="$(echo $elixir_current | sed -n $version_regex)" | |
local elixir_current_conf="$(echo $elixir_current | sed -n $config_regex)" | |
local erlang_current="$(asdf current erlang)" | |
local erlang_current_version="$(echo $erlang_current | sed -n $version_regex)" | |
local erlang_current_conf="$(echo $erlang_current | sed -n $config_regex)" | |
if [[ "${asdf_global_conf}" != "${elixir_current_conf}" || "${asdf_global_conf}" != "${erlang_current_conf}" ]]; then | |
"$1_prompt_segment" "$0" "$2" "mediumpurple4" "white" "$elixir_current_version (on Erlang $erlang_current_version)" 'ELIXIR_ICON' | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment