summaryrefslogtreecommitdiffstats
path: root/src/init
diff options
context:
space:
mode:
authorMatan Kushner <hello@matchai.me>2019-09-25 17:13:58 +0900
committerGitHub <noreply@github.com>2019-09-25 17:13:58 +0900
commitcaaf3bc6a951022bc5a7ba4ce4fe4f5586fb33b1 (patch)
tree84b68cb57ee0ec7dbc1c446b3b9ef325368cab32 /src/init
parente6761e63ed4da3bb150c66acebe547f73bae897f (diff)
revert: Revert the command duration in ms feature (#380) (#425)
Due to incompatibilities with the macOS date utility, we are temporarily reverting this feature. Refs: #c5e971a
Diffstat (limited to 'src/init')
-rw-r--r--src/init/starship.bash8
-rw-r--r--src/init/starship.fish4
-rw-r--r--src/init/starship.zsh6
3 files changed, 9 insertions, 9 deletions
diff --git a/src/init/starship.bash b/src/init/starship.bash
index bc1bf9afe..da02f6e42 100644
--- a/src/init/starship.bash
+++ b/src/init/starship.bash
@@ -17,7 +17,7 @@ starship_preexec() {
# Avoid restarting the timer for commands in the same pipeline
if [ "$PREEXEC_READY" = "true" ]; then
PREEXEC_READY=false
- STARSHIP_START_TIME=$(date +%s%0N)
+ STARSHIP_START_TIME=$(date +%s)
fi
}
@@ -31,7 +31,7 @@ starship_precmd() {
# Prepare the timer data, if needed.
if [[ $STARSHIP_START_TIME ]]; then
- STARSHIP_END_TIME=$(date +%s%0N)
+ STARSHIP_END_TIME=$(date +%s)
STARSHIP_DURATION=$((STARSHIP_END_TIME - STARSHIP_START_TIME))
PS1="$(::STARSHIP:: prompt --status=$STATUS --jobs="$(jobs -p | wc -l)" --cmd-duration=$STARSHIP_DURATION)"
unset STARSHIP_START_TIME
@@ -65,5 +65,5 @@ else
fi
# Set up the start time and STARSHIP_SHELL, which controls shell-specific sequences
-STARSHIP_START_TIME=$(date +%s%0N)
-export STARSHIP_SHELL="bash"
+STARSHIP_START_TIME=$(date +%s)
+export STARSHIP_SHELL="bash" \ No newline at end of file
diff --git a/src/init/starship.fish b/src/init/starship.fish
index f9409f5b5..b2e88e5ee 100644
--- a/src/init/starship.fish
+++ b/src/init/starship.fish
@@ -8,8 +8,8 @@ function fish_prompt
set -l exit_code $status
# Account for changes in variable name between v2.7 and v3.0
set -l CMD_DURATION "$CMD_DURATION$cmd_duration"
- set -l starship_duration_ns {$CMD_DURATION}000000
- ::STARSHIP:: prompt --status=$exit_code --keymap=$keymap --cmd-duration=$starship_duration_ns --jobs=(count (jobs -p))
+ set -l starship_duration (math --scale=0 "$CMD_DURATION / 1000")
+ ::STARSHIP:: prompt --status=$exit_code --keymap=$keymap --cmd-duration=$starship_duration --jobs=(count (jobs -p))
end
function fish_mode_prompt; end
export STARSHIP_SHELL="fish"
diff --git a/src/init/starship.zsh b/src/init/starship.zsh
index 7b638ccbb..fdae70e12 100644
--- a/src/init/starship.zsh
+++ b/src/init/starship.zsh
@@ -19,7 +19,7 @@ starship_precmd() {
NUM_JOBS=$#jobstates
# Compute cmd_duration, if we have a time to consume
if [[ ! -z "${STARSHIP_START_TIME+1}" ]]; then
- STARSHIP_END_TIME="$(date +%s%0N)"
+ STARSHIP_END_TIME="$(date +%s)"
STARSHIP_DURATION=$((STARSHIP_END_TIME - STARSHIP_START_TIME))
PROMPT="$(::STARSHIP:: prompt --status=$STATUS --cmd-duration=$STARSHIP_DURATION --jobs="$NUM_JOBS")"
unset STARSHIP_START_TIME
@@ -28,7 +28,7 @@ starship_precmd() {
fi
}
starship_preexec(){
- STARSHIP_START_TIME="$(date +%s%0N)"
+ STARSHIP_START_TIME="$(date +%s)"
}
# If precmd/preexec arrays are not already set, set them. If we don't do this,
@@ -53,6 +53,6 @@ function zle-keymap-select
zle reset-prompt
}
-STARSHIP_START_TIME="$(date +%s%0N)"
+STARSHIP_START_TIME="$(date +%s)"
zle -N zle-keymap-select
export STARSHIP_SHELL="zsh"