Skip to content

actively calling showHelp shows different output then help on fail does #1853

@foxriver76

Description

@foxriver76

In our code we use commands and "subcommands", calling our tool via iobroker object will result in our code processing the command and then calling yargs.showHelp(), the generated output looks like:

iob object
Unknown command "object undefined"!
iobroker object

Object management

Commands:
  iobroker get <id>                                     Get object specified by id
...
...
...

I would expect, that it shows iobroker object get <id> and not iobroker get <id> as it is done when I call iobroker object --help:

moritz@moritz-ThinkPad-E470:~/workspaces/ioBroker.js-controller$ iob object --help
iobroker object

Object management

Commands:
  iobroker object get <id>                                     Get object specified by id
...
...
...

Why is there a difference, is this intended? If yes, how can I achieve the desired output via showHelp()?

You can find the relevant code here: https://github.com/ioBroker/ioBroker.js-controller/blob/12a235299be58d7bb4592d71d61478afe9f1797b/lib/setup.js#L34-L370

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions