Added anaconda segment.
The segment relies on a lookaround to determine the currently active conda environment. If available ack is preferred, otherwise grep will be used. Recent versions of grep offer `-P` to support perl-regex. Older ones (e.g. those shipped on OSX) will fail.
This commit is contained in:
parent
511bbcf124
commit
391b3327ee
2 changed files with 23 additions and 0 deletions
|
@ -288,6 +288,18 @@ right_prompt_segment() {
|
|||
# right-left but reads the opposite, this isn't necessary for the other side.
|
||||
CURRENT_BG='NONE'
|
||||
|
||||
# Anaconda Environment
|
||||
prompt_anaconda() {
|
||||
if $(hash ack 2>/dev/null); then
|
||||
local active_conda_env=$(where conda | ack -o '(?<=envs/)[\w-]+(?=/bin)')
|
||||
else
|
||||
local active_conda_env=$(where conda | grep -o -P '(?<=envs/)[\w-]+(?=/bin)')
|
||||
fi
|
||||
if [[ -n $active_conda_env ]]; then
|
||||
"$1_prompt_segment" "$0" "$2" "green" "black" "($active_conda_env)" ""
|
||||
fi
|
||||
}
|
||||
|
||||
# AWS Profile
|
||||
prompt_aws() {
|
||||
local aws_profile="$AWS_DEFAULT_PROFILE"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue