Implement maintainer feedback

Reinitializes the script at most once every day. This is necessary because doing so every
time could lead to thousands of concurrent writes calling `| par-each { nu -c }`.
This commit is contained in:
Texas Toland 2024-03-17 12:37:45 -05:00
parent d7e95cdb42
commit d7826592eb
2 changed files with 29 additions and 20 deletions

View File

@ -339,21 +339,28 @@ eval $(starship init ion)
<details> <details>
<summary>Nushell</summary> <summary>Nushell</summary>
Add the following to the end of your Nushell env file (find it by running `$nu.env-path` in Nushell): Since Nu does [not support `eval`](https://www.nushell.sh/book/how_nushell_code_gets_run.html#eval-function) the initialization script is saved in `env.nu`:
```sh ```nushell
mkdir ~/.cache/starship '
starship init nu | save -f ~/.cache/starship/init.nu let starship_path = $nu.default-config-dir | path join scripts starship.nu
if $nu.is-interactive {
starship init nu | save $starship_path --force
}' | save $nu.env-path --append
'
if $nu.is-interactive {
use starship.nu
}' | save $nu.config-path --append
``` ```
And add the following to the end of your Nushell configuration (find it by running `$nu.config-path`): If you prefer to keep your dotfiles clean you can save it to a different directory then update `$env.NU_LIB_DIRS`:
```sh ```nushell
use ~/.cache/starship/init.nu '
$env.NU_LIB_DIRS ++= ($starship_path | path dirname | to nuon)
' | save $nu.env-path --append
``` ```
Note: Only Nushell v0.78+ is supported
</details> </details>
<details> <details>

View File

@ -137,24 +137,26 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
#### Nushell #### Nushell
Since Nu does [not support `eval`](https://www.nushell.sh/book/how_nushell_code_gets_run.html#eval-function) you must save the initialization script: Since Nu does [not support `eval`](https://www.nushell.sh/book/how_nushell_code_gets_run.html#eval-function) the initialization script is saved in `env.nu`:
```nushell ```nushell
'
let starship_path = $nu.default-config-dir | path join scripts starship.nu let starship_path = $nu.default-config-dir | path join scripts starship.nu
starship init nu | save $starship_path --force if $nu.is-interactive {
"\nuse starship.nu" | save $nu.config-path --append starship init nu | save $starship_path --force
}' | save $nu.env-path --append
'
if $nu.is-interactive {
use starship.nu
}' | save $nu.config-path --append
``` ```
If you prefer to keep your dotfiles clean you can save it to another directory then update `$env.NU_LIB_DIRS`: If you prefer to keep your dotfiles clean you can save it to a different directory then update `$env.NU_LIB_DIRS`:
```nushell ```nushell
"\n$env.NU_LIB_DIRS ++= ($starship_path | path dirname | to nuon)" | save $nu.env-path --append '
``` $env.NU_LIB_DIRS ++= ($starship_path | path dirname | to nuon)
' | save $nu.env-path --append
You can update the generated script at any time by re-running:
```nushell
starship init nu | save $starship_path --force
``` ```
#### Xonsh #### Xonsh