Skip to content

Conversation

@leonqadirie
Copy link
Contributor

Adds Nushell (nu) support to path_env_at_directory/2 in port.ex.
Specifically: Adds a "nu" case in path_env_at_directory/2 that uses ; for command chaining and $env.PATH | str join ":" to convert the PATH list to a colon-separated string.


Nushell differs from POSIX shells in two ways:

  • The && operator is not supported (requires ; or and)
  • PATH is stored as a list in $env.PATH, not a colon-separated string

Currently, Expert crashes immediately when SHELL is set to Nushell:

Error: nu::parser::shell_andand

  x The '&&' operator is not supported in Nushell
   ,-[source:1:39]
 1 | cd /path/to/project && printf "EXPERT_PATH:%s:EXPERT_PATH" "$PATH"
   :                     ^|
   :                      `-- instead of '&&', use ';' or 'and'

Adds Nushell (`nu`) support to `path_env_at_directory/2`.

Nushell differs from POSIX shells in two ways:
- The `&&` operator is not supported (requires `;` or `and`)
- PATH is stored as a list in `$env.PATH`, not a colon-separated string

Currently, Expert crashes immediately when `SHELL` is set to Nushell:

```
Error: nu::parser::shell_andand

  x The '&&' operator is not supported in Nushell
   ,-[source:1:39]
 1 | cd /path/to/project && printf "EXPERT_PATH:%s:EXPERT_PATH" "$PATH"
   :                     ^|
   :                      `-- instead of '&&', use ';' or 'and'
```

## Changes
- Add `"nu"` case in `path_env_at_directory/2` that uses `;` for command chaining and `$env.PATH | str join ":"` to convert the PATH list to a colon-separated string.
@mhanberg
Copy link
Member

Looks good, just fix up the formatter errors

@mhanberg mhanberg merged commit 8a9fd3d into elixir-lang:main Dec 20, 2025
36 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants