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

Method list

deps/npm/lib/commands/token.js:71–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69 }
70
71 async list () {
72 const json = this.npm.config.get('json')
73 const parseable = this.npm.config.get('parseable')
74 log.info('token', 'getting list')
75 const tokens = await paginate('/-/npm/v1/tokens', this.npm.flatOptions)
76 if (json) {
77 output.buffer(tokens)
78 return
79 }
80 if (parseable) {
81 output.standard(['key', 'token', 'created', 'readonly', 'CIDR whitelist'].join('\t'))
82 tokens.forEach(token => {
83 output.standard(
84 [
85 token.key,
86 token.token,
87 token.created,
88 token.readonly ? 'true' : 'false',
89 token.cidr_whitelist ? token.cidr_whitelist.join(',') : '',
90 ].join('\t')
91 )
92 })
93 return
94 }
95 this.generateTokenIds(tokens, 6)
96 const chalk = this.npm.chalk
97 for (const token of tokens) {
98 const created = String(token.created).slice(0, 10)
99 output.standard(`${chalk.blue('Token')} ${token.token}… with id ${chalk.cyan(token.id)} created ${created}`)
100 if (token.cidr_whitelist) {
101 output.standard(`with IP whitelist: ${chalk.green(token.cidr_whitelist.join(','))}`)
102 }
103 output.standard()
104 }
105 }
106
107 async rm (args) {
108 if (args.length === 0) {

Callers 2

execMethod · 0.95
marked.jsFile · 0.45

Calls 11

generateTokenIdsMethod · 0.95
paginateFunction · 0.85
StringClass · 0.85
infoMethod · 0.80
blueMethod · 0.80
getMethod · 0.65
forEachMethod · 0.65
sliceMethod · 0.65
bufferMethod · 0.45
joinMethod · 0.45
greenMethod · 0.45

Tested by

no test coverage detected