From bf790aad7c3af8b5ec643c129a3703bdef04b460 Mon Sep 17 00:00:00 2001 From: Jan Klass Date: Fri, 1 Nov 2024 19:17:30 +0100 Subject: [PATCH 1/8] Fix absolute path example item text The relative example follows afterwards. This block only contains docs on absolute paths. --- book/modules/using_modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/modules/using_modules.md b/book/modules/using_modules.md index 06c9c1ec54..fde40a3385 100644 --- a/book/modules/using_modules.md +++ b/book/modules/using_modules.md @@ -42,7 +42,7 @@ The module's documentation will usually tell you the recommended way to import i The path to the module can be: -- An absolute or relative path to a directory containing a `mod.nu` file: +- An absolute path to a directory containing a `mod.nu` file: ::: details Example From 9eea190c86573d0354ae169bdb9b82bc436f7bb4 Mon Sep 17 00:00:00 2001 From: Jan Klass Date: Fri, 1 Nov 2024 19:19:34 +0100 Subject: [PATCH 2/8] Fix NU_LIB_PATH -> NU_LIB_DIRS `$env.NU_LIB_PATH` does not exist In the block that follows the correct name is being used. --- book/modules/using_modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/modules/using_modules.md b/book/modules/using_modules.md index fde40a3385..2901960e94 100644 --- a/book/modules/using_modules.md +++ b/book/modules/using_modules.md @@ -69,7 +69,7 @@ The path to the module can be: Note that the module name (its directory) can end in a `/` (or `\` on Windows), but as with most commands that take a paths (e.g., `cd`), this is completely optional. ::: - ::: important Important! Importing modules from `$env.NU_LIB_PATH` + ::: 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. From eec91995ea3a5138df268eadd5ea120340f7b102 Mon Sep 17 00:00:00 2001 From: Jan Klass Date: Fri, 1 Nov 2024 19:21:17 +0100 Subject: [PATCH 3/8] Remain consistent across code examples The blocks demonstrate different things, but it's confusing to have different code - mixing both behavior changes through context and unnecessary code changes. --- book/modules/using_modules.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/modules/using_modules.md b/book/modules/using_modules.md index 2901960e94..051c57ce1d 100644 --- a/book/modules/using_modules.md +++ b/book/modules/using_modules.md @@ -193,7 +193,7 @@ assert true # => Assertion passes hide assert -assert equal 1 1 +assert equal 1 2 # => Error: # => help: A command with that name exists in module `assert`. Try importing it with `use` @@ -208,7 +208,7 @@ Just as you can `use` a subset of the module's definitions, you can also `hide` ```nu use std/assert hide assert main -assert equal 1 1 +assert equal 1 2 # => assertion passes assert true From f790b3ff7ef4edee7d231787d00c51f7724dcced Mon Sep 17 00:00:00 2001 From: Jan Klass Date: Fri, 1 Nov 2024 19:22:44 +0100 Subject: [PATCH 4/8] Fix sentence wording --- book/modules/using_modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/modules/using_modules.md b/book/modules/using_modules.md index 051c57ce1d..cb35342f19 100644 --- a/book/modules/using_modules.md +++ b/book/modules/using_modules.md @@ -100,7 +100,7 @@ The path to the module can be: ::: -- Less commonly, the name of a module already created with the [`module`](/commands/docs/module.md) command. While it is possible to use this command to create a module at the commandline, this isn't common or useful. Instead, this form is primarily used by module authors to define a submodule. See [Creating Modules - Submodules](./creating_modules.md#submodules). +- Less commonly, the name of a module is created with the [`module`](/commands/docs/module.md) command. While it is possible to use this command to create a module at the commandline, this isn't common or useful. Instead, this form is primarily used by module authors to define a submodule. See [Creating Modules - Submodules](./creating_modules.md#submodules). ### Module Definitions From 41f99b44468b28445b7ef44428f0859ee1969806 Mon Sep 17 00:00:00 2001 From: Jan Klass Date: Fri, 1 Nov 2024 19:27:58 +0100 Subject: [PATCH 5/8] Simplify sentences by dropping 'simply' Increases readability and clarity. Using 'simply' can indicate that actions are simple. But adding it without a need for differentiation or qualification, they increase sentence complexity, making it harder to read and parse. The statements remain just as valid without them. --- book/modules/using_modules.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/modules/using_modules.md b/book/modules/using_modules.md index cb35342f19..849e001e7c 100644 --- a/book/modules/using_modules.md +++ b/book/modules/using_modules.md @@ -25,7 +25,7 @@ The example above uses the [Standard Library](../standard_library.md), a collect ## Installing Modules -Installing a module is simply a matter of placing its files in a directory. This might be done via `git clone` (or other version control system), a package manager such as `nupm`, or manually. The module's documentation should provide recommendations. +Installing a module is a matter of placing its files in a directory. This might be done via `git clone` (or other version control system), a package manager such as `nupm`, or manually. The module's documentation should provide recommendations. ## Importing Modules @@ -217,11 +217,11 @@ assert true ``` ::: tip -`main` is covered in more detail in [Creating Modules](./creating_modules.md#main-exports), but for end-users, `main` simply means "the command named the same as the module." In this case the `assert` module exports a `main` command that "masquerades" as the `assert` command. Hiding `main` has the effect of hiding the `assert` command, but not its subcommands. +`main` is covered in more detail in [Creating Modules](./creating_modules.md#main-exports), but for end-users, `main` means "the command named the same as the module." In this case the `assert` module exports a `main` command that "masquerades" as the `assert` command. Hiding `main` has the effect of hiding the `assert` command, but not its subcommands. ::: ## See Also -- To make a module always be available without having to `use` it in each Nushell session, simply add its import (`use`) to your startup configuration. See the [Configuration](../configuration.md) Chapter to learn how. +- To make a module always be available without having to `use` it in each Nushell session, add its import (`use`) to your startup configuration. See the [Configuration](../configuration.md) Chapter to learn how. - Modules can also be used as part of an [Overlay](../overlays.md). From 1abe6625a7205a55defaeea11396698666760a3e Mon Sep 17 00:00:00 2001 From: Jan Klass Date: Fri, 1 Nov 2024 19:31:49 +0100 Subject: [PATCH 6/8] Split absolute and relative path examples 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. --- book/modules/using_modules.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/book/modules/using_modules.md b/book/modules/using_modules.md index 849e001e7c..ba458d2888 100644 --- a/book/modules/using_modules.md +++ b/book/modules/using_modules.md @@ -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 From e5de007b8134a86cbefef7a6ed7061fef9c77c20 Mon Sep 17 00:00:00 2001 From: Jan Klass Date: Mon, 18 Nov 2024 12:11:59 +0100 Subject: [PATCH 7/8] Revert "Remain consistent across code examples" This reverts commit eec91995ea3a5138df268eadd5ea120340f7b102. --- book/modules/using_modules.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/modules/using_modules.md b/book/modules/using_modules.md index ba458d2888..102385e63b 100644 --- a/book/modules/using_modules.md +++ b/book/modules/using_modules.md @@ -207,7 +207,7 @@ assert true # => Assertion passes hide assert -assert equal 1 2 +assert equal 1 1 # => Error: # => help: A command with that name exists in module `assert`. Try importing it with `use` @@ -222,7 +222,7 @@ Just as you can `use` a subset of the module's definitions, you can also `hide` ```nu use std/assert hide assert main -assert equal 1 2 +assert equal 1 1 # => assertion passes assert true From 9068c2422ed2f8d9beb1f2676057d2d554ec64a1 Mon Sep 17 00:00:00 2001 From: Jan Klass Date: Mon, 18 Nov 2024 12:14:25 +0100 Subject: [PATCH 8/8] Partially revert "Simplify sentences by dropping 'simply'" This partially reverts commit 41f99b44468b28445b7ef44428f0859ee1969806. --- book/modules/using_modules.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/modules/using_modules.md b/book/modules/using_modules.md index 102385e63b..f4fd5faab1 100644 --- a/book/modules/using_modules.md +++ b/book/modules/using_modules.md @@ -25,7 +25,7 @@ The example above uses the [Standard Library](../standard_library.md), a collect ## Installing Modules -Installing a module is a matter of placing its files in a directory. This might be done via `git clone` (or other version control system), a package manager such as `nupm`, or manually. The module's documentation should provide recommendations. +Installing a module is simply a matter of placing its files in a directory. This might be done via `git clone` (or other version control system), a package manager such as `nupm`, or manually. The module's documentation should provide recommendations. ## Importing Modules @@ -231,7 +231,7 @@ assert true ``` ::: tip -`main` is covered in more detail in [Creating Modules](./creating_modules.md#main-exports), but for end-users, `main` means "the command named the same as the module." In this case the `assert` module exports a `main` command that "masquerades" as the `assert` command. Hiding `main` has the effect of hiding the `assert` command, but not its subcommands. +`main` is covered in more detail in [Creating Modules](./creating_modules.md#main-exports), but for end-users, `main` simply means "the command named the same as the module." In this case the `assert` module exports a `main` command that "masquerades" as the `assert` command. Hiding `main` has the effect of hiding the `assert` command, but not its subcommands. ::: ## See Also