2021-11-04 20:42:47 +00:00
|
|
|
const BaseCommand = require('../base-command.js')
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2021-03-11 17:54:23 -05:00
|
|
|
class Set extends BaseCommand {
|
2021-11-18 20:58:02 +00:00
|
|
|
static description = 'Set a value in the npm configuration'
|
|
|
|
static name = 'set'
|
|
|
|
static usage = ['<key>=<value> [<key>=<value> ...] (See `npm config`)']
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2021-11-18 20:58:02 +00:00
|
|
|
// TODO
|
|
|
|
/* istanbul ignore next */
|
2021-03-04 17:40:28 -05:00
|
|
|
async completion (opts) {
|
2021-11-04 20:42:47 +00:00
|
|
|
return this.npm.cmd('config').completion(opts)
|
2021-03-04 17:40:28 -05:00
|
|
|
}
|
2021-03-01 11:38:43 -05:00
|
|
|
|
2021-11-04 20:42:47 +00:00
|
|
|
async exec (args) {
|
2021-11-18 20:58:02 +00:00
|
|
|
if (!args.length) {
|
2021-11-04 20:42:47 +00:00
|
|
|
throw this.usageError()
|
2021-11-18 20:58:02 +00:00
|
|
|
}
|
2021-11-04 20:42:47 +00:00
|
|
|
return this.npm.exec('config', ['set'].concat(args))
|
2021-03-04 17:40:28 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = Set
|