set.js 749 B

1234567891011121314151617181920212223242526272829
  1. const BaseCommand = require('./base-command.js')
  2. class Set extends BaseCommand {
  3. static get description () {
  4. return 'Set a value in the npm configuration'
  5. }
  6. /* istanbul ignore next - see test/lib/load-all-commands.js */
  7. static get name () {
  8. return 'set'
  9. }
  10. /* istanbul ignore next - see test/lib/load-all-commands.js */
  11. static get usage () {
  12. return ['<key>=<value> [<key>=<value> ...] (See `npm config`)']
  13. }
  14. /* istanbul ignore next - see test/lib/load-all-commands.js */
  15. async completion (opts) {
  16. return this.npm.commands.config.completion(opts)
  17. }
  18. exec (args, cb) {
  19. if (!args.length)
  20. return cb(this.usageError())
  21. this.npm.commands.config(['set'].concat(args), cb)
  22. }
  23. }
  24. module.exports = Set