oclif / core

Node.js Open CLI Framework. Built by Salesforce.

Home Page:https://oclif.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

topicSeparator space generates wrong message when used alongside usage

otaviojacobi opened this issue · comments

Describe the bug
When using "oclif"."topicSeparator": " " alongside a "usage" override in the command, the generated help is incorrect.

To Reproduce
When I use for example mynewcli first:second and I have the usage for this command/topic to be something like const usage = 'first:second <something>' this will generate a help with usage like "first:second ", however, if I do the same using mynewcli first second" and use a topicSeparator of " ", and usage is const usage = 'first second 'the generated help will befirst second first second ` duplicating the usage name.

Expected behavior
I expected that usage should be similar when using any topicSeparator, without duplicating the command.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS & version: Ubuntu 22.04
  • Shell/terminal & version: zsh

Additional context
Debugging, I found that this is caused be cause here it gets the standarizedId: https://github.com/oclif/core/blob/main/src/help/command.ts#L334 and then just replaces it https://github.com/oclif/core/blob/main/src/help/command.ts#L346

I think we could also replace the configuredId, so that I can use the expected "usage" as above

This issue has been linked to a new work item: W-15226684