twolfson / commander-completion

Shell completion for commander.js
The Unlicense
26 stars 4 forks source link

Allow completion for options #4

Open twolfson opened 10 years ago

twolfson commented 10 years ago

Currently, commander does not provide a slick venue for providing completion options on option values (supported by completion). We should consider how to achieve this

program
  .command('hello')
  // Probably has issues with existing functionality
  .option('--dir <cwd>', 'Directory', function () {});

// or

program
  .command('hello')
  .completableOption('--dir <cwd>', 'Directory', {
    completion: function (info, cb) {
      // ...
    }
  })

http://visionmedia.github.io/commander.js/#Command.prototype.option