summaryrefslogtreecommitdiff
path: root/dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/exec_time.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/exec_time.zsh')
-rw-r--r--dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/exec_time.zsh30
1 files changed, 30 insertions, 0 deletions
diff --git a/dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/exec_time.zsh b/dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/exec_time.zsh
new file mode 100644
index 00000000..8fed682c
--- /dev/null
+++ b/dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/exec_time.zsh
@@ -0,0 +1,30 @@
+#
+# Execution time
+#
+# Execution time of the last command.
+
+# ------------------------------------------------------------------------------
+# Configuration
+# ------------------------------------------------------------------------------
+
+SPACESHIP_EXEC_TIME_SHOW="${SPACESHIP_EXEC_TIME_SHOW=true}"
+SPACESHIP_EXEC_TIME_PREFIX="${SPACESHIP_EXEC_TIME_PREFIX="took "}"
+SPACESHIP_EXEC_TIME_SUFFIX="${SPACESHIP_EXEC_TIME_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
+SPACESHIP_EXEC_TIME_COLOR="${SPACESHIP_EXEC_TIME_COLOR="yellow"}"
+SPACESHIP_EXEC_TIME_ELAPSED="${SPACESHIP_EXEC_TIME_ELAPSED=2}"
+
+# ------------------------------------------------------------------------------
+# Section
+# ------------------------------------------------------------------------------
+
+spaceship_exec_time() {
+ [[ $SPACESHIP_EXEC_TIME_SHOW == false ]] && return
+
+ if [[ $SPACESHIP_EXEC_TIME_duration -ge $SPACESHIP_EXEC_TIME_ELAPSED ]]; then
+ spaceship::section \
+ "$SPACESHIP_EXEC_TIME_COLOR" \
+ "$SPACESHIP_EXEC_TIME_PREFIX" \
+ "$(spaceship::displaytime $SPACESHIP_EXEC_TIME_duration)" \
+ "$SPACESHIP_EXEC_TIME_SUFFIX"
+ fi
+}