-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Help texts from multiple modules are printed with --help #14033
Copy link
Copy link
Closed
Labels
A:help-systemRelated to help commands and our documentation system (not docs itself)Related to help commands and our documentation system (not docs itself)status:needs-triageAn issue that hasn't had any proper lookAn issue that hasn't had any proper look
Milestone
Description
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.nufile exporting both modules.
export module module1.nu
export module module2.nu-
Run
use exports.nu *. -
Run
module1 --helpormodule2 --helpand the help texts for bothmodule1andmodule2prints.
$ 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 |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A:help-systemRelated to help commands and our documentation system (not docs itself)Related to help commands and our documentation system (not docs itself)status:needs-triageAn issue that hasn't had any proper lookAn issue that hasn't had any proper look