mirror of
https://github.com/starship/starship.git
synced 2024-11-25 09:43:36 +01:00
fix(elvish): upgrade shell integration for v0.17 (#3310)
This commit is contained in:
parent
52abffaec6
commit
67cddb616b
@ -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
|
||||
|
@ -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`:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user