-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Help flag propagated for every module used #14402
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 I run a Nushell script using --help flag, I want to only see the relevant help around main func, but it seems to be propagating to other modules in place as well.
How to reproduce
Create a new script called debugging.nu
#!/usr/bin/env nu
use std/log
def main (data: string = "dummy") {
print $"data: ($data)"
}Then run nu debugging.nu --help, which would yield:
❯ nu debugging.nu --help
Logging module
Log formatting placeholders:
- %MSG%: message to be logged
- %DATE%: date of log
- %LEVEL%: string prefix for the log level
- %ANSI_START%: ansi formatting
- %ANSI_STOP%: literally (ansi reset)
Note: All placeholders are optional, so "" is still a valid format
Example: $"%ANSI_START%%DATE%|%LEVEL%|(ansi u)%MSG%%ANSI_STOP%"
Usage:
> debugging.nu
Flags:
-h, --help: Display the help message for this command
Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯
======================
Usage:
> debugging.nu (data)
Flags:
-h, --help: Display the help message for this command
Parameters:
data <string>: (optional, default: 'dummy')
Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯Expected behavior
I expect the help message will only show from the main function of the target file (in this case debugging.nu's main function only)
Configuration
| key | value |
|---|---|
| version | 0.99.1 |
| major | 0 |
| minor | 99 |
| patch | 1 |
| branch | |
| commit_hash | |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.81.0 (eeb90cda1 2024-09-04) (built from a source tarball) |
| cargo_version | cargo 1.81.0 (2dbb1af80 2024-08-20) |
| build_time | 1980-01-01 00:00:00 +00:00 |
| build_rust_channel | release |
| allocator | mimalloc |
| features | default, sqlite, trash |
| installed_plugins | dbus 0.12.0, polars 0.99.1 |
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