1 var mapToRegistry = require('./utils/map-to-registry.js')
2 var npm = require('./npm')
6 team.subcommands = ['create', 'destroy', 'add', 'rm', 'ls', 'edit']
9 'npm team create <scope:team>\n' +
10 'npm team destroy <scope:team>\n' +
11 'npm team add <scope:team> <user>\n' +
12 'npm team rm <scope:team> <user>\n' +
13 'npm team ls <scope>|<scope:team>\n' +
14 'npm team edit <scope:team>'
16 team.completion = function (opts, cb) {
17 var argv = opts.conf.argv.remain
18 if (argv.length === 2) {
19 return cb(null, team.subcommands)
30 return cb(new Error(argv[2] + ' not recognized'))
34 function team (args, cb) {
35 // Entities are in the format <scope>:<team>
36 var cmd = args.shift()
37 var entity = (args.shift() || '').split(':')
38 return mapToRegistry('/', npm.config, function (err, uri, auth) {
39 if (err) { return cb(err) }
41 return npm.registry.team(cmd, uri, {
46 }, function (err, data) {
47 !err && data && console.log(JSON.stringify(data, undefined, 2))
51 cb(e.message + '\n\nUsage:\n' + team.usage)