summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--docs/README.md2
-rwxr-xr-xinstall/install.sh2
-rw-r--r--src/init/starship.elv38
4 files changed, 9 insertions, 35 deletions
diff --git a/README.md b/README.md
index 195591f2f..c728feccc 100644
--- a/README.md
+++ b/README.md
@@ -258,7 +258,7 @@ shown below. Can't see yours? Have a look at the [extra platform instructions](h
#### Elvish
- **Warning** Only elvish v0.15 or higher is supported.
+ **Warning** Only elvish v0.17 or higher is supported.
Add the following to the end of `~/.elvish/rc.elv`:
```sh
diff --git a/docs/README.md b/docs/README.md
index 4014bfc2b..3c40ec151 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -110,7 +110,7 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
#### Elvish
::: warning
- Only elvish v0.15 or higher is supported.
+ Only elvish v0.17 or higher is supported.
:::
Add the following to the end of `~/.elvish/rc.elv`:
diff --git a/install/install.sh b/install/install.sh
index a1b06c2d6..196b84f31 100755
--- a/install/install.sh
+++ b/install/install.sh
@@ -317,7 +317,7 @@ print_install() {
# shellcheck disable=SC2088
config_file="~/.elvish/rc.elv"
config_cmd="eval (starship init elvish)"
- warning="${warning} Only elvish v0.15 or higher is supported."
+ warning="${warning} Only elvish v0.17 or higher is supported."
;;
nushell )
# shellcheck disable=SC2088
diff --git a/src/init/starship.elv b/src/init/starship.elv
index 1f68f1c88..d9552be84 100644
--- a/src/init/starship.elv
+++ b/src/init/starship.elv
@@ -1,43 +1,17 @@
set-env STARSHIP_SHELL "elvish"
set-env STARSHIP_SESSION_KEY (::STARSHIP:: session)
-# Define Hooks
-local:cmd-start-time = 0
-local:cmd-end-time = 0
-local:cmd-duration = 0
-
-fn starship-after-readline-hook [line]{
- cmd-start-time = (::STARSHIP:: time)
-}
-
-fn starship-before-readline-hook {
- cmd-end-time = (::STARSHIP:: time)
- cmd-duration = (- $cmd-end-time $cmd-start-time)
-}
-
-# Install Hooks
-edit:after-readline = [ $@edit:after-readline $starship-after-readline-hook~ ]
-edit:before-readline = [ $@edit:before-readline $starship-before-readline-hook~ ]
-
# Install starship
-edit:prompt = {
+set edit:prompt = {
# Note:
# Elvish does not appear to support exit status codes (--status)
-
- if (== $cmd-start-time 0) {
- ::STARSHIP:: prompt --jobs=$num-bg-jobs
- } else {
- ::STARSHIP:: prompt --jobs=$num-bg-jobs --cmd-duration=$cmd-duration
- }
+ var cmd-duration = (printf "%.0f" (* $edit:command-duration 1000))
+ ::STARSHIP:: prompt --jobs=$num-bg-jobs --cmd-duration=$cmd-duration
}
-edit:rprompt = {
+set edit:rprompt = {
# Note:
# Elvish does not appear to support exit status codes (--status)
-
- if (== $cmd-start-time 0) {
- ::STARSHIP:: prompt --right --jobs=$num-bg-jobs
- } else {
- ::STARSHIP:: prompt --right --jobs=$num-bg-jobs --cmd-duration=$cmd-duration
- }
+ var cmd-duration = (printf "%.0f" (* $edit:command-duration 1000))
+ ::STARSHIP:: prompt --right --jobs=$num-bg-jobs --cmd-duration=$cmd-duration
}