Skip to content

Help texts from multiple modules are printed with --help #14033

Closed

Description

@vlovgr

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

  1. Create a file module1.nu.
# Help text for module1.nu
export def main [] { "module1.nu" }
  1. Create a file module2.nu.
# Help text for module2.nu
export def main [] { "module2.nu" }
  1. Create a exports.nu file exporting both modules.
export module module1.nu
export module module2.nu
  1. Run use exports.nu *.

  2. 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

Activity

  1. added
    status:needs-triage
    on Oct 9, 2024
  2. added
    A:help-system
    on Oct 9, 2024
  3. fdncred commented on Oct 9, 2024

    @fdncred
    Contributor

    /cc @devyn potentially IR related

  4. fdncred commented on Dec 10, 2024

    @fdncred
    Contributor

    closed by #14490

  5. added this to the v0.101.0 milestone on Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:help-systemstatus:needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions