Describe the bug
When running --help on a custom command imported from a file which exports other modules, the help texts for all exported modules are printed. This behaviour is new since 0.98.0 and can currently be worked around by disabling the new IR and evaluator with $env.NU_DISABLE_IR = true.
How to reproduce
- Create a file
module1.nu.
# Help text for module1.nu
export def main [] { "module1.nu" }
- Create a file
module2.nu.
# Help text for module2.nu
export def main [] { "module2.nu" }
- Create a
exports.nu file exporting both modules.
export module module1.nu
export module module2.nu
-
Run use exports.nu *.
-
Run module1 --help or module2 --help and the help texts for both module1 and module2 prints.
$ module1 --help
Help text for module1.nu
Usage:
> main
Flags:
-h, --help - Display the help message for this command
Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯
======================
Help text for module2.nu
Usage:
> main
Flags:
-h, --help - Display the help message for this command
Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯
$ module2 --help
Help text for module1.nu
Usage:
> main
Flags:
-h, --help - Display the help message for this command
Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯
======================
Help text for module2.nu
Usage:
> main
Flags:
-h, --help - Display the help message for this command
Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯
Expected behavior
I expect only the help text for module1 to show when module1 --help is run, and similarly for module2. This was the behaviour prior to 0.98.0, and if I set $env.NU_DISABLE_IR = true, then the expected behaviour is achieved.
Configuration
| key |
value |
| version |
0.98.0 |
| major |
0 |
| minor |
98 |
| patch |
0 |
| branch |
|
| commit_hash |
6e1e824 |
| build_os |
windows-x86_64 |
| build_target |
x86_64-pc-windows-msvc |
| rust_version |
rustc 1.79.0 (129f3b996 2024-06-10) |
| rust_channel |
1.79.0-x86_64-pc-windows-msvc |
| cargo_version |
cargo 1.79.0 (ffa9cf99a 2024-06-03) |
| build_time |
2024-09-18 08:03:04 +00:00 |
| build_rust_channel |
release |
| allocator |
mimalloc |
| features |
default, sqlite, trash |
| installed_plugins |
query 0.98.0 |
Describe the bug
When running
--helpon a custom command imported from a file which exports other modules, the help texts for all exported modules are printed. This behaviour is new since 0.98.0 and can currently be worked around by disabling the new IR and evaluator with$env.NU_DISABLE_IR = true.How to reproduce
module1.nu.module2.nu.exports.nufile exporting both modules.Run
use exports.nu *.Run
module1 --helpormodule2 --helpand the help texts for bothmodule1andmodule2prints.Expected behavior
I expect only the help text for
module1to show whenmodule1 --helpis run, and similarly formodule2. This was the behaviour prior to 0.98.0, and if I set$env.NU_DISABLE_IR = true, then the expected behaviour is achieved.Configuration