Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Conda environment module #31

Merged
merged 3 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/powerline_full_256col.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ declare -a PL_MODULES=(
'ssh_module MyYellow Black'
'screen_session_module MyBlue Black'
'virtual_env_module MyBlue Black'
'conda_env_module MyBlue Black'
'aws_profile_module MyLime Black'
'path_module MyBlue Black'
'read_only_module MyRed White'
Expand Down
1 change: 1 addition & 0 deletions configs/powerline_full_8col.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare -a PL_MODULES=(
'ssh_module Yellow Black'
'screen_session_module Blue Black'
'virtual_env_module Blue Black'
'conda_env_module Blue Black'
'aws_profile_module Yellow Black'
'path_module Blue Black'
'read_only_module Red White'
Expand Down
1 change: 1 addition & 0 deletions configs/tty_full.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare -a PL_MODULES=(
'ssh_module Yellow Black'
'screen_session_module Blue Black'
'virtual_env_module Blue Black'
'conda_env_module Blue Black'
'path_module Blue Black'
'read_only_module Red White'
'background_jobs_module Purple Black'
Expand Down
16 changes: 16 additions & 0 deletions pureline
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,22 @@ function virtual_env_module {
fi
}

# -----------------------------------------------------------------------------
# append to prompt: conda virtual environment name
# arg: $1 foreground color
# arg; $2 background color
function conda_env_module {
if ! [ "$CONDA_SHLVL" -eq "0" ]; then
local venv="${CONDA_DEFAULT_ENV##*/}"
local bg_color="$1"
local fg_color="$2"
local content=" ${PL_SYMBOLS[python]} $venv"
PS1+="$(section_end $fg_color $bg_color)"
PS1+="$(section_content $fg_color $bg_color "$content ")"
__last_color="$bg_color"
fi
}

# -----------------------------------------------------------------------------
# append to prompt: indicator for battery level
# arg: $1 foreground color
Expand Down