/home/techb158/.nvm/versions/node/v16.20.2/lib/node_modules/npm/lib/commands
NameSizeModeActions
access.js55850644editdlrm
adduser.js22530644editdlrm
audit.js122340644editdlrm
bin.js7290644editdlrm
birthday.js5080644editdlrm
bugs.js8150644editdlrm
cache.js72470644editdlrm
ci.js37150644editdlrm
completion.js91240644editdlrm
config.js83080644editdlrm
dedupe.js14050644editdlrm
deprecate.js21090644editdlrm
diff.js82910644editdlrm
dist-tag.js56040644editdlrm
docs.js4470644editdlrm
doctor.js94460644editdlrm
edit.js20470644editdlrm
exec.js24990644editdlrm
explain.js36390644editdlrm
explore.js23870644editdlrm
find-dupes.js6020644editdlrm
fund.js65240644editdlrm
get.js5240644editdlrm
help-search.js57550644editdlrm
help.js46370644editdlrm
hook.js40270644editdlrm
init.js69720644editdlrm
install-ci-test.js3770644editdlrm
install-test.js3740644editdlrm
install.js52360644editdlrm
link.js51410644editdlrm
ll.js2340644editdlrm
logout.js13770644editdlrm
ls.js173510644editdlrm
org.js43050644editdlrm
outdated.js90500644editdlrm
owner.js60180644editdlrm
pack.js24190644editdlrm
ping.js8740644editdlrm
pkg.js35540644editdlrm
prefix.js3430644editdlrm
profile.js115250644editdlrm
prune.js7790644editdlrm
publish.js64810644editdlrm
query.js28730644editdlrm
rebuild.js22140644editdlrm
repo.js12720644editdlrm
restart.js3510644editdlrm
root.js2980644editdlrm
run-script.js70670644editdlrm
search.js27810644editdlrm
set-script.js26980644editdlrm
set.js5720644editdlrm
shrinkwrap.js27050644editdlrm
star.js19110644editdlrm
stars.js10520644editdlrm
start.js3410644editdlrm
stop.js3360644editdlrm
team.js45450644editdlrm
test.js3360644editdlrm
token.js69540644editdlrm
uninstall.js15520644editdlrm
unpublish.js46170644editdlrm
unstar.js1820644editdlrm
update.js17380644editdlrm
version.js36900644editdlrm
view.js147230644editdlrm
whoami.js5140644editdlrm
Edit: /home/techb158/.nvm/versions/node/v16.20.2/lib/node_modules/npm/lib/commands/team.js (4545B)
const columns = require('cli-columns') const libteam = require('libnpmteam') const otplease = require('../utils/otplease.js') const BaseCommand = require('../base-command.js') class Team extends BaseCommand { static description = 'Manage organization teams and team memberships' static name = 'team' static usage = [ 'create [--otp ]', 'destroy [--otp ]', 'add [--otp ]', 'rm [--otp ]', 'ls |', ] static params = [ 'registry', 'otp', 'parseable', 'json', ] static ignoreImplicitWorkspace = false async completion (opts) { const { conf: { argv: { remain: argv } } } = opts const subcommands = ['create', 'destroy', 'add', 'rm', 'ls'] if (argv.length === 2) { return subcommands } if (subcommands.includes(argv[2])) { return [] } throw new Error(argv[2] + ' not recognized') } async exec ([cmd, entity = '', user = '']) { // Entities are in the format : // XXX: "description" option to libnpmteam is used as a description of the // team, but in npm's options, this is a boolean meaning "show the // description in npm search output". Hence its being set to null here. await otplease(this.npm, { ...this.npm.flatOptions }, opts => { entity = entity.replace(/^@/, '') switch (cmd) { case 'create': return this.create(entity, opts) case 'destroy': return this.destroy(entity, opts) case 'add': return this.add(entity, user, opts) case 'rm': return this.rm(entity, user, opts) case 'ls': { const match = entity.match(/[^:]+:.+/) if (match) { return this.listUsers(entity, opts) } else { return this.listTeams(entity, opts) } } default: throw this.usageError() } }) } async create (entity, opts) { await libteam.create(entity, opts) if (opts.json) { this.npm.output(JSON.stringify({ created: true, team: entity, })) } else if (opts.parseable) { this.npm.output(`${entity}\tcreated`) } else if (!this.npm.silent) { this.npm.output(`+@${entity}`) } } async destroy (entity, opts) { await libteam.destroy(entity, opts) if (opts.json) { this.npm.output(JSON.stringify({ deleted: true, team: entity, })) } else if (opts.parseable) { this.npm.output(`${entity}\tdeleted`) } else if (!this.npm.silent) { this.npm.output(`-@${entity}`) } } async add (entity, user, opts) { await libteam.add(user, entity, opts) if (opts.json) { this.npm.output(JSON.stringify({ added: true, team: entity, user, })) } else if (opts.parseable) { this.npm.output(`${user}\t${entity}\tadded`) } else if (!this.npm.silent) { this.npm.output(`${user} added to @${entity}`) } } async rm (entity, user, opts) { await libteam.rm(user, entity, opts) if (opts.json) { this.npm.output(JSON.stringify({ removed: true, team: entity, user, })) } else if (opts.parseable) { this.npm.output(`${user}\t${entity}\tremoved`) } else if (!this.npm.silent) { this.npm.output(`${user} removed from @${entity}`) } } async listUsers (entity, opts) { const users = (await libteam.lsUsers(entity, opts)).sort() if (opts.json) { this.npm.output(JSON.stringify(users, null, 2)) } else if (opts.parseable) { this.npm.output(users.join('\n')) } else if (!this.npm.silent) { const plural = users.length === 1 ? '' : 's' const more = users.length === 0 ? '' : ':\n' this.npm.output(`\n@${entity} has ${users.length} user${plural}${more}`) this.npm.output(columns(users, { padding: 1 })) } } async listTeams (entity, opts) { const teams = (await libteam.lsTeams(entity, opts)).sort() if (opts.json) { this.npm.output(JSON.stringify(teams, null, 2)) } else if (opts.parseable) { this.npm.output(teams.join('\n')) } else if (!this.npm.silent) { const plural = teams.length === 1 ? '' : 's' const more = teams.length === 0 ? '' : ':\n' this.npm.output(`\n@${entity} has ${teams.length} team${plural}${more}`) this.npm.output(columns(teams.map(t => `@${t}`), { padding: 1 })) } } } module.exports = Team