Skip to content

formatted_flags always prints all flags #16418

@kaathewisegit

Description

@kaathewisegit

The logic in Signature::formatted_flags make it seem that the intent was to truncate more than 10 flags, but it always prints all of them.

https://github.com/nushell/nushell/blob/main/crates/nu-protocol/src/signature.rs#L628-L658

Example:

~> ulimit --doesnt-exist
Error: nu::parser::unknown_flag

  × The `ulimit` command doesn't have flag `doesnt-exist`.
   ╭─[entry #12:1:8]
 1 │ ulimit --doesnt-exist
   ·        ───────┬──────
   ·               ╰── unknown flag
   ╰────
  help: Some available flags: --help(-h), --soft(-S), --hard(-H), --all(-a), --core-size(-c), --data-size(-d), --nice(-e), --file-size(-f), --pending-signals(-i),
        --lock-size(-l), --resident-set-size(-m), --file-descriptor-count(-n), --queue-size(-q), --realtime-priority(-r), --stack-size(-s), --cpu-time(-t), --process-
        count(-u), --virtual-memory-size(-v), --file-locks(-x), --realtime-maxtime(-y)... Use `--help` for a full list of flags and more information.

Currently this method is only used by the parser. I wonder if it would be a good idea to use did_you_mean instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:error-unhelpfulThe error message you observe is not helpful to identify the problemA:parserIssues related to parsingcategory:enhancementNew feature or requestpolishthis problem makes nu feel unpolished

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions