Skip to content

Commit

Permalink
Split absolute and relative path examples
Browse files Browse the repository at this point in the history
The concern before this one already has split sections.

Rather than a block with two mixed concerns, and a need for "or"  text in a mixed-concern example attempting to demonstrate two things at once,
having two blocks makes it much more obvious, distinct, and reference-able (when the reader is only interested in one aspect).

It also simplifies the NU_LIB_DIRS concern a lot. Instead of a long block headline with a lot of mixed information, we do the same as the other concern earlier in the document:
note the information in an important note block.
  • Loading branch information
Kissaki committed Nov 1, 2024
1 parent 4550911 commit c769824
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions book/modules/using_modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,33 @@ The path to the module can be:
This allows you to install modules to a location that is easily accessible via a relative path regardless of the current directory.
:::

- An absolute or relative path to a Nushell module file. As above, Nushell will search the `$env.NU_LIB_DIRS` for a matching relative path.
- An absolute path to a Nushell module file:

::: details Example

```nu
use ~/nushell/modules/std-rfc/bulk-rename.nu
# Or
```

:::

- A relative path to a Nushell module file:

::: details Example

```nu
cd ~/nushell/modules
use std-rfc/bulk-rename.nu
```

:::

::: important Important! Importing modules from `$env.NU_LIB_DIRS`
When importing a module via a relative path, Nushell first searches from the current directory. If a matching module is not found at that location, Nushell then searches each directory in the `$env.NU_LIB_DIRS` list.

This allows you to install modules to a location that is easily accessible via a relative path regardless of the current directory.
:::

- A virtual directory:

::: details Example
Expand Down

0 comments on commit c769824

Please sign in to comment.