-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding simple conda env segment (#98)
- Loading branch information
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#! /usr/bin/env bash | ||
|
||
segments::conda() { | ||
if [[ -n "$CONDA_DEFAULT_ENV" ]]; then | ||
print_themed_segment 'normal' "$CONDA_DEFAULT_ENV" | ||
fi | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bats | ||
|
||
load segment_helper | ||
|
||
@test "test that we recognize a Conda profile" { | ||
export CONDA_DEFAULT_ENV='my_env' | ||
mapfile -t result <<< "$(execute_segment)" | ||
assert_equal "${#result[@]}" 2 | ||
assert_equal "${result[0]}" 'normal' | ||
assert_equal "${result[1]}" "$CONDA_DEFAULT_ENV" | ||
} | ||
|
||
@test "test that we do nothing without a Conda profile" { | ||
unset CONDA_DEFAULT_ENV | ||
result="$(execute_segment)" | ||
assert_equal "$result" '' | ||
} | ||
|