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-03-23 14:58:11 -04:00
|
|
|
static get description () {
|
|
|
|
return 'Set a value in the npm configuration'
|
|
|
|
}
|
|
|
|
|
2021-03-11 17:54:23 -05:00
|
|
|
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
|
|
|
static get name () {
|
|
|
|
return 'set'
|
2021-03-04 17:40:28 -05:00
|
|
|
}
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2021-03-11 17:54:23 -05:00
|
|
|
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
|
|
|
static get usage () {
|
|
|
|
return ['<key>=<value> [<key>=<value> ...] (See `npm config`)']
|
2021-03-04 17:40:28 -05:00
|
|
|
}
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2021-03-04 17:40:28 -05:00
|
|
|
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
|
|
|
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-03-04 17:40:28 -05:00
|
|
|
if (!args.length)
|
2021-11-04 20:42:47 +00:00
|
|
|
throw this.usageError()
|
|
|
|
return this.npm.exec('config', ['set'].concat(args))
|
2021-03-04 17:40:28 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = Set
|