Commander.js: Poll: change api for adding command arguments?

Created on 13 Feb 2021  路  3Comments  路  Source: tj/commander.js

The syntax for adding command arguments which have help descriptions is quite different from the rest of the API, and arguments and options are added quite differently although they could be similar. (Prompted by discussion about offering .choices() for arguments in #1458.)

A couple of questions for feedback via reactions or comments.

Most helpful comment

1) Argument descriptions. Current syntax:

program
  .arguments('<username> [password]')
  .description('test command', {
    username: 'user to login',
    password: 'password for user, if required'
  })

Suggested syntax:

program
  .description('test command')
  .argument('<username>', 'user to login')
  .argument('[password]', 'password for user, if required')

Should .argument(usage, description) replace the use of .description(cmdDesc, argsDesc) for specifying help for command-arguments? 馃憤 馃憥

All 3 comments

1) Argument descriptions. Current syntax:

program
  .arguments('<username> [password]')
  .description('test command', {
    username: 'user to login',
    password: 'password for user, if required'
  })

Suggested syntax:

program
  .description('test command')
  .argument('<username>', 'user to login')
  .argument('[password]', 'password for user, if required')

Should .argument(usage, description) replace the use of .description(cmdDesc, argsDesc) for specifying help for command-arguments? 馃憤 馃憥

  1. Adding arguments. Current syntax:
program
  .arguments('<cmd> [args]');

Suggested syntax:

  .argument('<cmd>')
  .argument('[args]');

Should .argument() replace the use of .arguments() for adding command-arguments? 馃憤 馃憥

Not huge numbers, but unanimous positive response after a month. (Thanks for feedback.)

  1. 8 馃憤
  2. 5 馃憤
Was this page helpful?
0 / 5 - 0 ratings

Related issues

FerencH picture FerencH  路  4Comments

DeoLeung picture DeoLeung  路  4Comments

winys picture winys  路  5Comments

shadowspawn picture shadowspawn  路  4Comments

hossamelmansy picture hossamelmansy  路  4Comments