Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow arguments description without command description #1450

Closed
pv-g opened this issue Jan 30, 2021 · 1 comment
Closed

Allow arguments description without command description #1450

pv-g opened this issue Jan 30, 2021 · 1 comment

Comments

@pv-g
Copy link

pv-g commented Jan 30, 2021

Hi there, and thanks for the great work!

I'm in a situation where I want to add a description for my arguments, but not for my command.

Currently (using v6.2.1), adding both descriptions is possible with :

program
  .name('my-program')
  .arguments('<my-arg>')
  .description('my program desc', {
    'my-arg': 'my arg desc'
  })

// -> help is displaying all descriptions correctly ✅ 

However, if I try to omit the command description, while keeping the arguments description, it doesn't work.

program
  .name('my-program')
  .arguments('<my-arg>')
  .description(undefined, { // or null or ''
    'my-arg': 'my arg desc'
  })

// -> help is not displaying any description ❌ 

A workaround is to do :

program
  .name('my-program')
  .arguments('<my-arg>')
  .description('\x1B[2A', { // hack to skip command desc
    'my-arg': 'my arg desc'
  })

// -> help is not displaying command desc (kind of)
// and displaying args desc ✅  (well, it's a hack...)
// tested on macOS, and should also work on Unix-like OSes

It would be nice to have a proper way to do this ;)

@shadowspawn
Copy link
Collaborator

In Commander 7 this is supported. You may pass an empty string for the command description.

(This came up once before in #1192. At the time the arguments description was not documented.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants