From b697209d97021af213a991446a475064d4fb0b32 Mon Sep 17 00:00:00 2001 From: Texas Toland Date: Sun, 17 Mar 2024 14:06:28 -0500 Subject: [PATCH] Automate reinstallation Manually picked from starship/starship#5845. --- getting-started.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/getting-started.md b/getting-started.md index 1c594fd..2aaed32 100644 --- a/getting-started.md +++ b/getting-started.md @@ -326,26 +326,27 @@ See [`MISE_FISH_AUTO_ACTIVATE=1`](/configuration#mise_fish_auto_activate1) for m #### Nushell -Since Nu does [not support `eval`](https://www.nushell.sh/book/how_nushell_code_gets_run.html#eval-function) you must save the activation 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 +' let mise_path = $nu.default-config-dir | path join scripts mise.nu -^mise activate nu | save $mise_path --force +if not ( + $mise_path | path exists +) or ( + (date now) - (ls $mise_path).modified.0 > 1day +) { + ^mise activate nu | save $mise_path --force +}' | save $nu.env-path --append "\nuse mise.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 "\n$env.NU_LIB_DIRS ++= ($mise_path | path dirname | to nuon)" | save $nu.env-path --append ``` -You can update the generated script at any time by re-running: - -```nushell -^mise activate nu | save $mise_path --force -``` - #### Xonsh Since `.xsh` files are [not compiled](https://github.com/xonsh/xonsh/issues/3953) you may shave a bit off startup time by using a pure Python import: add the code below to, for example, `~/.config/xonsh/mise.py` config file and `import mise` it in `~/.config/xonsh/rc.xsh`: