MCPcopy Index your code
hub / github.com/nodejs/node / exec

Method exec

deps/npm/lib/commands/team.js:41–65  ·  view source on GitHub ↗
([cmd, entity = '', user = ''])

Source from the content-addressed store, hash-verified

39 }
40
41 async exec ([cmd, entity = '', user = '']) {
42 // Entities are in the format <scope>:<team>
43 // XXX: "description" option to libnpmteam is used as a description of the team, but in npm's options
44 // this is a boolean meaning "show the description in npm search output".
45 // Hence its being set to null here.
46 await otplease(this.npm, { ...this.npm.flatOptions }, opts => {
47 entity = entity.replace(/^@/, '')
48 switch (cmd) {
49 case 'create': return this.create(entity, opts)
50 case 'destroy': return this.destroy(entity, opts)
51 case 'add': return this.add(entity, user, opts)
52 case 'rm': return this.rm(entity, user, opts)
53 case 'ls': {
54 const match = entity.match(/[^:]+:.+/)
55 if (match) {
56 return this.listUsers(entity, opts)
57 } else {
58 return this.listTeams(entity, opts)
59 }
60 }
61 default:
62 throw this.usageError()
63 }
64 })
65 }
66
67 async create (entity, opts) {
68 await libteam.create(entity, opts)

Callers

nothing calls this directly

Calls 9

createMethod · 0.95
destroyMethod · 0.95
addMethod · 0.95
rmMethod · 0.95
listUsersMethod · 0.95
listTeamsMethod · 0.95
otpleaseFunction · 0.85
usageErrorMethod · 0.80
matchMethod · 0.65

Tested by

no test coverage detected