summaryrefslogtreecommitdiff
path: root/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_conda.fish
diff options
context:
space:
mode:
authorRoger Gonzalez <rogergonzalez21@gmail.com>2019-12-29 14:58:33 -0300
committerRoger Gonzalez <rogergonzalez21@gmail.com>2019-12-29 14:58:33 -0300
commitefb336a23b65a9a2d56889396b13c1757bdaf354 (patch)
tree234e40115f79a84c8a755df6fb932cc6797e36e1 /.config/fisher/github.com/matchai/spacefish/functions/__sf_section_conda.fish
Initial commit
Diffstat (limited to '.config/fisher/github.com/matchai/spacefish/functions/__sf_section_conda.fish')
-rw-r--r--.config/fisher/github.com/matchai/spacefish/functions/__sf_section_conda.fish36
1 files changed, 36 insertions, 0 deletions
diff --git a/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_conda.fish b/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_conda.fish
new file mode 100644
index 00000000..c93e5896
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_conda.fish
@@ -0,0 +1,36 @@
+#
+# Conda
+#
+# Current Conda version.
+
+function __sf_section_conda -d "Display current Conda version"
+ # ------------------------------------------------------------------------------
+ # Configuration
+ # ------------------------------------------------------------------------------
+
+ __sf_util_set_default SPACEFISH_CONDA_SHOW true
+ __sf_util_set_default SPACEFISH_CONDA_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
+ __sf_util_set_default SPACEFISH_CONDA_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
+ __sf_util_set_default SPACEFISH_CONDA_SYMBOL "🅒 "
+ __sf_util_set_default SPACEFISH_CONDA_COLOR blue
+
+ # ------------------------------------------------------------------------------
+ # Section
+ # ------------------------------------------------------------------------------
+
+ [ $SPACEFISH_CONDA_SHOW = false ]; and return
+
+ # Show Conda version only if conda is installed and CONDA_DEFAULT_ENV is set
+ if not type -q conda; \
+ or test -z "$CONDA_DEFAULT_ENV";
+ return
+ end
+
+ set -l conda_version (conda -V | string split ' ')[2]
+
+ __sf_lib_section \
+ $SPACEFISH_CONDA_COLOR \
+ $SPACEFISH_CONDA_PREFIX \
+ "$SPACEFISH_CONDA_SYMBOL"v"$conda_version" \
+ $SPACEFISH_CONDA_SUFFIX
+end