Skip to content

Commit

Permalink
fix: replace deprecated let-env
Browse files Browse the repository at this point in the history
`let-env FOO = ...` has been removed, use `$env.FOO = ...` instead.
See https://www.nushell.sh/commands/docs/let-env.html#frontmatter-title-for-removed
  • Loading branch information
lorenzk committed Sep 1, 2023
1 parent e83d71e commit 3156706
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions asdf.nu
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
def-env configure-asdf [] {

let-env ASDF_DIR = ( if ( $env | get --ignore-errors ASDF_DIR | is-empty ) { $env.ASDF_NU_DIR } else { $env.ASDF_DIR } )
$env.ASDF_DIR = ( if ( $env | get --ignore-errors ASDF_DIR | is-empty ) { $env.ASDF_NU_DIR } else { $env.ASDF_DIR } )

let shims_dir = ( if ( $env | get --ignore-errors ASDF_DATA_DIR | is-empty ) { $env.HOME | path join '.asdf' } else { $env.ASDF_DIR } | path join 'shims' )

let asdf_bin_dir = ( $env.ASDF_DIR | path join 'bin' )


let-env PATH = ( $env.PATH | split row (char esep) | where { |p| $p != $shims_dir } | prepend $shims_dir )
let-env PATH = ( $env.PATH | split row (char esep) | where { |p| $p != $asdf_bin_dir } | prepend $asdf_bin_dir )
$env.PATH = ( $env.PATH | split row (char esep) | where { |p| $p != $shims_dir } | prepend $shims_dir )
$env.PATH = ( $env.PATH | split row (char esep) | where { |p| $p != $asdf_bin_dir } | prepend $asdf_bin_dir )

}

Expand Down
6 changes: 3 additions & 3 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ Add the following to `~/.config/powershell/profile.ps1`:
Add `asdf.nu` to your `~/.config/nushell/config.nu` with:

```shell
"\nlet-env ASDF_NU_DIR = ($env.HOME | path join '.asdf')\n source " + ($env.HOME | path join '.asdf/asdf.nu') | save --append $nu.config-path
"\n$env.ASDF_NU_DIR = ($env.HOME | path join '.asdf')\n source " + ($env.HOME | path join '.asdf/asdf.nu') | save --append $nu.config-path
```

Completions are automatically configured
Expand All @@ -311,7 +311,7 @@ Completions are automatically configured
Add `asdf.nu` to your `~/.config/nushell/config.nu` with:

```shell
"\nlet-env ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')\n source " + (brew --prefix asdf | into string | path join 'libexec/asdf.nu') | save --append $nu.config-path
"\n$env.ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')\n source " + (brew --prefix asdf | into string | path join 'libexec/asdf.nu') | save --append $nu.config-path
```

Completions are automatically configured
Expand All @@ -322,7 +322,7 @@ Completions are automatically configured
Add `asdf.nu` to your `~/.config/nushell/config.nu` with:

```shell
"\nlet-env ASDF_NU_DIR = '/opt/asdf-vm/'\n source /opt/asdf-vm/asdf.nu" | save --append $nu.config-path
"\n$env.ASDF_NU_DIR = '/opt/asdf-vm/'\n source /opt/asdf-vm/asdf.nu" | save --append $nu.config-path
```

Completions are automatically configured.
Expand Down
6 changes: 3 additions & 3 deletions docs/pt-br/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ Adicione a seguinte linha ao seu `~/.config/powershell/profile.ps1`:
Adicione `asdf.nu` ao seu `~/.config/nushell/config.nu` através do comando:

```shell
"\nlet-env ASDF_NU_DIR = ($env.HOME | path join '.asdf')\n source " + ($env.HOME | path join '.asdf/asdf.nu') | save --append $nu.config-path
"\n$env.ASDF_NU_DIR = ($env.HOME | path join '.asdf')\n source " + ($env.HOME | path join '.asdf/asdf.nu') | save --append $nu.config-path
```

Ao concluir atualizará automaticamente
Expand All @@ -308,7 +308,7 @@ Ao concluir atualizará automaticamente
Adicione `asdf.nu` ao seu `~/.config/nushell/config.nu` através do comando:

```shell
"\nlet-env ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')\n source " + (brew --prefix asdf | into string | path join 'libexec/asdf.nu') | save --append $nu.config-path
"\n$env.ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')\n source " + (brew --prefix asdf | into string | path join 'libexec/asdf.nu') | save --append $nu.config-path
```

Ao concluir atualizará automaticamente
Expand All @@ -319,7 +319,7 @@ Ao concluir atualizará automaticamente
Adicione `asdf.nu` ao seu `~/.config/nushell/config.nu` através do comando:

```shell
"\nlet-env ASDF_NU_DIR = '/opt/asdf-vm/'\n source /opt/asdf-vm/asdf.nu" | save --append $nu.config-path
"\n$env.ASDF_NU_DIR = '/opt/asdf-vm/'\n source /opt/asdf-vm/asdf.nu" | save --append $nu.config-path
```

Ao concluir atualizará automaticamente
Expand Down
6 changes: 3 additions & 3 deletions docs/zh-hans/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ echo -e "\n. \"$(brew --prefix asdf)/libexec/asdf.ps1\"" >> ~/.config/powershell
使用以下命令将 `asdf.nu` 加入到 `~/.config/nushell/config.nu` 文件中:

```shell
"\nlet-env ASDF_NU_DIR = ($env.HOME | path join '.asdf')\n source " + ($env.HOME | path join '.asdf/asdf.nu') | save --append $nu.config-path
"\n$env.ASDF_NU_DIR = ($env.HOME | path join '.asdf')\n source " + ($env.HOME | path join '.asdf/asdf.nu') | save --append $nu.config-path
```

补全功能将会自动配置。
Expand All @@ -309,7 +309,7 @@ echo -e "\n. \"$(brew --prefix asdf)/libexec/asdf.ps1\"" >> ~/.config/powershell
使用以下命令将 `asdf.nu` 加入到 `~/.config/nushell/config.nu` 文件中:

```shell
"\nlet-env ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')\n source " + (brew --prefix asdf | into string | path join 'libexec/asdf.nu') | save --append $nu.config-path
"\n$env.ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')\n source " + (brew --prefix asdf | into string | path join 'libexec/asdf.nu') | save --append $nu.config-path
```

补全功能将会自动配置。
Expand All @@ -320,7 +320,7 @@ echo -e "\n. \"$(brew --prefix asdf)/libexec/asdf.ps1\"" >> ~/.config/powershell
使用以下命令将 `asdf.nu` 加入到 `~/.config/nushell/config.nu` 文件中:

```shell
"\nlet-env ASDF_NU_DIR = '/opt/asdf-vm/'\n source /opt/asdf-vm/asdf.nu" | save --append $nu.config-path
"\n$env.ASDF_NU_DIR = '/opt/asdf-vm/'\n source /opt/asdf-vm/asdf.nu" | save --append $nu.config-path
```

补全功能将会自动配置。
Expand Down
10 changes: 5 additions & 5 deletions test/asdf_nu.bats
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ run_nushell() {
run nu -c "
hide-env -i asdf
hide-env -i ASDF_DIR
let-env PATH = ( '$(cleaned_path)' | split row ':' )
let-env ASDF_NU_DIR = '$PWD'
\$env.PATH = ( '$(cleaned_path)' | split row ':' )
\$env.ASDF_NU_DIR = '$PWD'
source asdf.nu
$1"
Expand Down Expand Up @@ -63,9 +63,9 @@ run_nushell() {
@test "retains ASDF_DIR" {
run nu -c "
hide-env -i asdf
let-env ASDF_DIR = ( pwd )
let-env PATH = ( '$(cleaned_path)' | split row ':' )
let-env ASDF_NU_DIR = '$PWD'
\$env.ASDF_DIR = ( pwd )
\$env.PATH = ( '$(cleaned_path)' | split row ':' )
\$env.ASDF_NU_DIR = '$PWD'
source asdf.nu
Expand Down

0 comments on commit 3156706

Please sign in to comment.