disable directory submodule auto export#11157
Conversation
|
for now with # mod.nu
export use lib/foo.nu
export def top [] {
print "`top` from `mod.nu`"
}# lib/foo.nu
export def "foo-1" [] {
print "`foo-1` from `lib/foo.nu`"
}
export def "foo-2" [] {
print "`foo-2` from `lib/foo.nu`"
}
EDITi've added some temporary debug statements in dae78e1 and what i'm confused about for now is that the two as expected so i'm not sure where the issue comes from 😕 |
|
actually i think this error does not have anything to do with the changes in this PR 🤔 i'm able to reproduce it with Nushell 0.87.1 |
this will bring the change made to `use foo bar baz` when `bar` is a command of `foo` and not a submodule -> should give an error.
|
I see what it is. You need to use will define three commands inside the module and export them: On the other hand: will define Basically, the rule of thumb is to always use There are two problems currently:
|
|
wow, thanks @kubouch, it appears to work very nice now 😮 let me fix the standard library tests 🙏 |
d9af111 to
612ac01
Compare
|
|
let's try this out 👍 |
depends on - nushell/nushell#11157 - nushell/nupm#47 - #140 - #141 ## description as directory modules won't export the modules next to any `mod.nu`, this PR adds `export module` calls to `nu-git-manager-sugar` and the tests, making the source base compatible again with nushell/nushell#11157 and nushell/nupm#47.
|
all the packages i know of have been fixed at that point 🆗 |
depends on - nushell/nushell#11157 - nushell/nupm#47 - #140 - #141 ## description as directory modules won't export the modules next to any `mod.nu`, this PR adds `export module` calls to `nu-git-manager-sugar` and the tests, making the source base compatible again with nushell/nushell#11157 and nushell/nupm#47.
should - close nushell#11133 # Description to allow more freedom when writing complex modules, we are disabling the auto-export of director modules. the change was as simple as removing the crawling of files and modules next to any `mod.nu` and update the standard library. # User-Facing Changes users will have to explicitely use `export module <mod>` to define submodules and `export use <mod> <cmd>` to re-export definitions, e.g. ```nushell # my-module/mod.nu export module foo.nu # export a submodule export use bar.nu bar-1 # re-export an internal command export def top [] { print "`top` from `mod.nu`" } ``` ```nushell # my-module/foo.nu export def "foo-1" [] { print "`foo-1` from `lib/foo.nu`" } export def "foo-2" [] { print "`foo-2` from `lib/foo.nu`" } ``` ```nushell # my-module/bar.nu export def "bar-1" [] { print "`bar-1` from `lib/bar.nu`" } ``` # Tests + Formatting i had to add `export module` calls in the `tests/modules/samples/spam` directory module and allow the `not_allowed` module to not give an error, it is just empty, which is fine. # After Submitting - mention in the release note - update the following repos ``` #┬─────name─────┬version┬─type─┬─────────repo───────── 0│nu-git-manager│0.4.0 │module│amtoine/nu-git-manager 1│nu-scripts │0.1.0 │module│amtoine/scripts 2│nu-zellij │0.1.0 │module│amtoine/zellij-layouts 3│nu-scripts │0.1.0 │module│nushell/nu_scripts 4│nupm │0.1.0 │module│nushell/nupm ─┴──────────────┴───────┴──────┴────────────────────── ```
should
Description
to allow more freedom when writing complex modules, we are disabling the auto-export of director modules.
the change was as simple as removing the crawling of files and modules next to any
mod.nuand update the standard library.User-Facing Changes
users will have to explicitely use
export module <mod>to define submodules andexport use <mod> <cmd>to re-export definitions, e.g.Tests + Formatting
i had to add
export modulecalls in thetests/modules/samples/spamdirectory module and allow thenot_allowedmodule to not give an error, it is just empty, which is fine.After Submitting
mod.nu)