• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1const Npm = require('../npm.js')
2const BaseCommand = require('../base-command.js')
3
4class Set extends BaseCommand {
5  static description = 'Set a value in the npm configuration'
6  static name = 'set'
7  static usage = ['<key>=<value> [<key>=<value> ...] (See `npm config`)']
8  static params = ['global', 'location']
9  static ignoreImplicitWorkspace = false
10
11  // TODO
12  /* istanbul ignore next */
13  static async completion (opts) {
14    const Config = Npm.cmd('config')
15    return Config.completion(opts)
16  }
17
18  async exec (args) {
19    if (!args.length) {
20      throw this.usageError()
21    }
22    return this.npm.exec('config', ['set'].concat(args))
23  }
24}
25module.exports = Set
26