Skip to content

Allow arguments description without command description #1450

@pv-g

Description

@pv-g

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 ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions