Skip to content

Commit 7896e51

Browse files
committed
fix: update the token list text
1 parent 91ebab7 commit 7896e51

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

lib/commands/token.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ class Token extends BaseCommand {
9595
this.generateTokenIds(tokens, 6)
9696
const chalk = this.npm.chalk
9797
for (const token of tokens) {
98-
const level = token.readonly ? 'Read only token' : 'Publish token'
9998
const created = String(token.created).slice(0, 10)
100-
output.standard(`${chalk.blue(level)} ${token.token}… with id ${chalk.cyan(token.id)} created ${created}`)
99+
output.standard(`${chalk.blue('Token')} ${token.token}… with id ${chalk.cyan(token.id)} created ${created}`)
101100
if (token.cidr_whitelist) {
102101
output.standard(`with IP whitelist: ${chalk.green(token.cidr_whitelist.join(','))}`)
103102
}
@@ -231,10 +230,7 @@ class Token extends BaseCommand {
231230
Object.keys(result).forEach(k => output.standard(k + '\t' + result[k]))
232231
} else {
233232
const chalk = this.npm.chalk
234-
// Display based on access level
235-
// Identical to list? XXX
236-
const level = result.access === 'read-only' || result.readonly ? 'read only' : 'publish'
237-
output.standard(`Created ${chalk.blue(level)} token ${result.token}`, { [META]: true, redact: false })
233+
output.standard(`Created token ${result.token}`, { [META]: true, redact: false })
238234
if (result.cidr_whitelist?.length) {
239235
output.standard(`with IP whitelist: ${chalk.green(result.cidr_whitelist.join(','))}`)
240236
}

test/lib/commands/token.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ t.test('token list', async t => {
6363
registry.getTokens(tokens)
6464
await npm.exec('token', [])
6565
t.strictSame(outputs, [
66-
`Publish token efgh5678efgh5678… with id abcd123 created ${now.slice(0, 10)}`,
66+
`Token efgh5678efgh5678… with id abcd123 created ${now.slice(0, 10)}`,
6767
'',
68-
`Read only token hgfe8765… with id abcd125 created ${now.slice(0, 10)}`,
68+
`Token hgfe8765… with id abcd125 created ${now.slice(0, 10)}`,
6969
'with IP whitelist: 192.168.1.1/32',
7070
'',
7171
])
@@ -263,7 +263,7 @@ t.test('token create defaults', async t => {
263263
})
264264

265265
await npm.exec('token', ['create'])
266-
t.match(outputs, ['Created publish token n3wt0k3n'])
266+
t.match(outputs, ['Created token n3wt0k3n'])
267267
})
268268

269269
t.test('token create extra token attributes', async t => {
@@ -311,7 +311,7 @@ t.test('token create extra token attributes', async t => {
311311

312312
await npm.exec('token', ['create'])
313313
t.match(outputs, [
314-
'Created read only token n3wt0k3n',
314+
'Created token n3wt0k3n',
315315
'with IP whitelist: 10.0.0.0/8,192.168.1.0/24',
316316
`expires: ${expires.toISOString()}`,
317317
])
@@ -340,7 +340,7 @@ t.test('token create access.read-only', async t => {
340340
})
341341

342342
await npm.exec('token', ['create'])
343-
t.match(outputs, ['Created read only token n3wt0k3n'])
343+
t.match(outputs, ['Created token n3wt0k3n'])
344344
})
345345

346346
t.test('token create readonly', async t => {
@@ -368,7 +368,7 @@ t.test('token create readonly', async t => {
368368
})
369369

370370
await npm.exec('token', ['create'])
371-
t.match(outputs, ['Created read only token n3wt0k3n'])
371+
t.match(outputs, ['Created token n3wt0k3n'])
372372
})
373373

374374
t.test('token create json output', async t => {

0 commit comments

Comments
 (0)